Commit Graph

595 Commits

Author SHA1 Message Date
hg333
b0e84a8c80 added custom type support 2021-08-29 12:19:18 +05:30
Luca Schlecker
823e891572 fix routing on windows. 2021-08-24 17:06:21 +02:00
Farook Al-Sammarraie
ddca7b5924
Merge branch 'master' into catchall_codes 2021-08-21 14:41:14 +03:00
The-EDev
db08b5a11d further simplified BP search code & made error_message const 2021-08-21 14:35:59 +03:00
The-EDev
10f3238ffc defining CROW_ENABLE_SSL disables non SSL code 2021-08-21 05:19:51 +03:00
The-EDev
576690bf14 Made catchall work with 404 or 405 errors
snuck in a fix for release.py where version name wouldn't change
also snuck in slight improvement in finding blueprint (removed extra if statement)
2021-08-21 04:49:17 +03:00
The-EDev
f5338260bb several changes:
added json list in a similar fashion to json object
renamed object_type to object
updated readme, index.html, and json.md to include objects and lists
updated examples to be slightly cleaner and include lists
replaced instances of json object (std::map and such) with the short version (object)
accurate floating point number dumping (`6.0` instead of `6`) while taking 1/30th of the time (29 microseconds saved)
added json list testing
snuck in utf-8 middleware warning fix
snuck in twitter card style for crowcpp.org site (makes social media cards look way better with a large image)
2021-08-20 03:57:21 +03:00
Farook Al-Sammarraie
84878ae4b1
Merge branch 'master' into ssl_test 2021-08-18 13:13:29 +03:00
Lucas David
49b020b9aa
Merge branch 'master' into feature-#189 2021-08-16 14:51:14 +02:00
The-EDev
17819e6571 Added middleware to automatically use utf-8 if no content-type is in the response 2021-08-15 15:28:26 +03:00
Farook Al-Sammarraie
fe52a2b117
Merge branch 'master' into feature-#189 2021-08-14 17:19:42 +03:00
himanshu007-creator
6ebea5ca77 remoteIpAddress 2021-08-14 18:58:23 +05:30
Himanshu
0f2b231448
Update http_request.h
CamelCase changed to snake_case
2021-08-14 18:01:19 +05:30
Lucas David
1e52b0182d ~ Corrected code as mentionned in review comments. 2021-08-11 22:25:58 +02:00
Lucas David
8f10f92627
Merge branch 'master' into feature-#189 2021-08-11 21:57:54 +02:00
Lucas David
df41cbec49 ~ Replaced foreach character type unsigned char by auto to resolve issue #195. 2021-08-11 15:43:40 +02:00
Lucas David
235f2b9ef4 + Added (implicit) constructors for json "supported" types.
+ added corresponding tests.
+ Added json-map examples.
2021-08-09 14:32:51 +02:00
Lucas David
762af68306 + Added object constructor and assignment for json::wvalue and unit tests.
+ json::wvalue::wvalue(std::initializer_list<std::pair<std::string const, json::wvalue>>
  + json::wvalue::wvalue(std::[unordered_]map<std::string, json::wvalue> const&)
  + json::wvalue::wvalue(std::[unordered_]map<std::string, json::wvalue>&&)
  + json::wvalue::operator=(std::initializer_list<std::pair<std::string const, json::wvalue>>)
  + json::wvalue::operator=(std::[unordered_]map<std::string, json::wvalue> const&)
  + json::wvalue::operator=(std::[unordered_]map<std::string, json::wvalue>&&)
2021-08-09 14:32:51 +02:00
Farook Al-Sammarraie
62af482f7b
Merge branch 'master' into patch-1 2021-08-07 03:24:26 +03:00
Dan Kersten
e6b36c3c03 Eliminate extern-initializer warning 2021-08-06 22:28:13 +01:00
Mustafa Mahmoud
d5c1b54918
Replace HTTPMethod::GET with HTTPMethod::Get 2021-08-06 19:01:13 +02:00
Farook Al-Sammarraie
8039b2eab9
Merge branch 'master' into blueprints 2021-08-05 19:54:02 +03:00
The-EDev
0588471d6d fixed extern constexpr problem 2021-08-05 19:53:52 +03:00
The-EDev
9418c39a92 fixed problem where using multiple files caused an error because you can't have extern constexpr 2021-08-05 17:01:03 +03:00
The-EDev
1474fbec33 used constant 0xffff in more places, used .empty(), and split the if statement into a method. 2021-08-04 23:58:38 +03:00
The-EDev
2def62bd4a removed unnecessary code / added constexpr for max bp id 2021-08-03 12:46:41 +03:00
Farook Al-Sammarraie
2d65f71de8
Merge branch 'master' into blueprints 2021-07-30 13:15:44 +03:00
The-EDev
addcce9e93 small fixes, optimizations, and documentation 2021-07-30 13:09:01 +03:00
The-EDev
e713ad54cb added unit test, moved macros to app.h, and fixed bug where "bp_prefix2" would be considered a child of "bp_prefix" even if it's not 2021-07-28 22:31:08 +03:00
Lucas David
1bb5e0ac63 + auto to_read = static_cast<std::uint64_t>(buffer_.size());
~ if (remaining_length_ < to_read)
~   to_read = remaining_length_;
+ adaptor_.socket().async_read_some(boost::asio::buffer(buffer_, static_cast<std::size_t>(to_read))
- size_t to_read = buffer_.size();
~ if (remaining_length_ < to_read)
~   to_read = remaining_length_;
- adaptor_.socket().async_read_some( boost::asio::buffer(buffer_, to_read)

~ Changed 'to_read' from [std::size_t] to [std::uint64_t],
  hence when 'remaining_length_' [std::uint64_t] is assigned in 'to_read' no data is lossed.
  When boost::asio::buffer is created 'to_read' is casted back to [std::size_t] explicitly truncating data.
  It seems to be the correct behavior to choose fixed 'network side' types.
2021-07-27 17:04:54 +02:00
Lucas David
6aa5dba579 + buf[1] += static_cast<char>(size);
- buf[1] += size;

~ Warning was triggered by 'size' being std::size_t and lossing data by implicit casting to a narrower type.
  This behavior seems correct, then we can explicit cast it.
2021-07-27 15:39:51 +02:00
The-EDev
06c4829ca7 implemented all blueprint features 2021-07-27 10:52:49 +03:00
The-EDev
27fe952a0c Merge branch 'master' 2021-07-20 11:00:09 +03:00
The-EDev
6d6fbe2385 removed unnecessary boolean 2021-07-19 00:01:20 +03:00
The-EDev
32d88725bd used CROW_LOG_DEBUG instead of std::cout (which was used to rapidly test the trie outside crow) 2021-07-10 23:14:38 +03:00
The-EDev
341a9b7fbe Re-implemented Trie 2021-07-10 22:45:47 +03:00
The-EDev
ea597d804a blueprint specific templates directory now supported 2021-07-07 15:51:04 +03:00
Farook Al-Sammarraie
da9f2e4531
Merge branch 'master' into release_script 2021-07-06 20:08:59 +03:00
Igor Mróz
3839a4a8e5
Add CROW_MAIN ifdef to VERSION variable. Move it to namespace. 2021-07-06 19:07:34 +02:00
The-EDev
85e4525d67 added custom static directory capability to blueprints (the endpoint remains "<prefix>/static/<filename>") 2021-07-06 01:53:32 +03:00
The-EDev
321f9c7fe6 Merge branch 'master' 2021-07-06 01:51:50 +03:00
The-EDev
165c72f56c fixed issue where disabling crow static directory would also disable all other routes 2021-07-05 12:18:00 +03:00
The-EDev
c46af69f41 Added basic blueprint support (registration and prefix) 2021-07-05 12:14:31 +03:00
The-EDev
6df5c94fd9 basic lambda support added (no expansion / blocks) 2021-07-03 23:28:52 +03:00
Igor Mróz
1d270fae19
Add release script. Change server name to use release version to build name. 2021-07-03 22:02:32 +02:00
Luca Schlecker
0593f42522 http_response: fix move assign operator not moving file_info.
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2021-06-28 18:08:57 +02:00
The-EDev
fc27f73f84 Bump server version to 0.3 2021-06-05 06:30:01 +03:00
The-EDev
ca31b85156 added CROW_ENABLE_COMPRESSION macro to enable zlib compression
This makes zlib dependency (which is quite problematic) optional
2021-06-03 17:12:20 +03:00
dspverden
5aa45f1ebc Changed to #ifndef in logging.h 2021-06-02 17:05:52 +02:00
Darius Tan
3bd1956e90 Change HTTPMethod::HEAD to HTTPMethod::Head, HTTPMethod::GET to
HTTPMethod::Get and HTTPMethod::OPTIONS to HTTPMethod::Options.

VS2019 error:
enum "crow::HTTPMethod" has no member "HEAD"
enum "crow::HTTPMethod" has no member "GET"
enum "crow::HTTPMethod" has no member "OPTIONS"

See https://github.com/ipkn/crow/pull/307 for a similar issue.
2021-05-23 19:58:01 +12:00
Maxime BELUGUET
811ef62c6f Fix constness on json dump method #133 2021-05-18 18:10:39 +02:00
The-EDev
0e9b615c2b fixed typos 2021-05-13 13:30:48 +03:00
The-EDev
f39b9ddce7 Quality of life improvements
Added pop() method to query_string, same as get(), but removes the item from the querystring
Added std::string() operator to json::rvalue (allows std::string(json["abc"]), which returns any value that isn't a container to string)
Added lo() method to json::rvalue, returns a vector of json::rvalue containing whatever a json object or list has (difference being a list has no keys)
Added keys() method to json::rvalue, returns a vector of std::string containing the keys of a json object
Made json::wvalue use either std::map or std::unordered_map instead of just std::unordered_map
Added copy constructor to json::wvalue
Added size() method to json::wvalue, returns 1 or the size of the json list.
Added constructor to create json::wvalue from std::vector
Added keys() method to query_string
Documented query_string and improved json doc
Made tests and examples for all the additions
2021-05-12 15:45:55 +03:00
The-EDev
798f190fc8 added initial ssl testing 2021-04-17 02:33:35 +03:00
The-EDev
5b7b066c68 fixed typo and incorrect type in assert error 2021-04-14 04:55:27 +03:00
Farook Al-Sammarraie
5f91587479
Merge branch 'master' into catch_all 2021-04-12 23:45:07 +03:00
The-EDev
738abdbd96 fixed issue where response is logged twice 2021-04-12 20:11:03 +03:00
Farook Al-Sammarraie
4aae614297
Merge branch 'master' into catch_all 2021-04-12 10:49:29 +03:00
The-EDev
16ae11a4e3 updated catchall to use references instead of pointers 2021-04-12 10:41:55 +03:00
The-EDev
f779a0f8a4 changed catchall to fit with the rest of crow
the macro is similar to CROW_ROUTE, added example to cmake, added unit test, and documentation
2021-04-12 08:25:09 +03:00
Tibbel
7ad1b79b7a
Delete example_catchall.cpp 2021-04-05 10:21:58 +02:00
Tibbel
97ef2945ed
CROW_CATCHALL #endif if moved
CROW_CATCHALL #endif if moved
2021-04-05 10:14:38 +02:00
Tibbel
5b880cef49
Add a catch-all handler 2nd version
Here is the modified catchall-function
example added
the code moved to routing.h
only the setter remained in app.h
the integer return is removed
i personally don't need the default parameters:
without crow::response the catchall can take no effect
and without crow::request you know nothing about the request
i only imagine one case, this is to set custom error pages.
so i don't thing default parameters have any big benefit here.
"#ifdef CROW_CATCHALL" was only for me, to find my own modifications feel free to replace it
2021-04-05 09:44:35 +02:00
The-EDev
111bef9deb use actual ASIO port instead of the local port variable
this is useful when using port 0 to have the OS provide a free port
2021-04-04 08:09:59 +03:00
The-EDev
b837877715 updated head and no_length variable names 2021-04-03 13:48:36 +03:00
The-EDev
5f68479ee5 fixed small merge issue 2021-04-03 06:40:14 +03:00
Farook Al-Sammarraie
1654acbfd0
Merge branch 'master' into HEAD_and_OPTIONS 2021-04-03 06:31:45 +03:00
The-EDev
33e8631676 Added Content-Length header back to HEAD response.
The reason for removing it was an issue with Curl rather than how HEAD should be handled.
2021-04-03 06:21:18 +03:00
The-EDev
ec566f87ef added tests and fixed small issues
moved body handling to Response.end() and fixed a bug where a 404 was not returned on a route that doesn't exist
2021-04-03 06:00:23 +03:00
The-EDev
06226b86a7 implemented proper HEAD handling, implemented OPTIONS handling 2021-04-03 05:33:40 +03:00
Farook Al-Sammarraie
b826e9c228
Merge branch 'master' into sfinktah-64bit-compat-1 2021-04-02 03:36:09 +03:00
Maxim Kokryashkin
cdce8f443a macro rename 2021-03-31 20:30:32 +03:00
Maxim Kokryashkin
a4ec6d06ce delete tags 2021-03-13 15:06:35 +03:00
The-EDev
6f5514743a added automatic HEAD method handling 2021-03-13 13:51:27 +03:00
Sfinktah Bungholio
21f6f11484 Merge branch 'master' of https://github.com/CrowCpp/crow into sfinktah-64bit-compat-1 2021-02-21 11:14:52 +11:00
Sfinktah Bungholio
6597feb3a8 converted all (int) to static_cast 2021-02-21 11:14:30 +11:00
Maxim Kokryashkin
ce7d08eb0e fixed issues with static wariables 2021-02-21 00:28:32 +03:00
rittelle
3b151d569d Properly clear responses
Closes #104.
2021-02-12 13:21:59 +01:00
Farook Al-Sammarraie
e15b50ed29
Merge branch 'master' into sfinktah-msvc17-compat-1 2021-02-12 01:43:56 +03:00
Sfinktah Bungholio
b2cf780485 recast 64-bit size_t to 32-bit int to remove warnings 2021-02-10 21:03:21 +11:00
The-EDev
8523afa930 Update templating.md and mustache.h
Updated templating documentation to mention "working directory" rather than "executable directory".
Added Warning log when a template is not found.
2021-02-09 06:52:05 +03:00
sfinktah
02f664c340
Update common.h
oops, had to remove #undef DELETE -- used to enable refactoring without MS DELETE macro getting in the way.
2021-02-09 03:29:07 +11:00
Sfinktah Bungholio
740bd266e7 fixes for **some** msvc compatibility issues 2021-02-09 03:25:02 +11:00
The-EDev
747ad6db72 Merge branch 'master' 2021-01-21 21:37:55 +03:00
The-EDev
3aaef5e0fd fixed merge errors 2021-01-21 21:36:41 +03:00
The-EDev
78ee97124b Merge branch 'master'
Conflicts:
	CMakeLists.txt
	examples/CMakeLists.txt
	include/crow/http_connection.h
	tests/CMakeLists.txt
2021-01-21 06:56:02 +03:00
The-EDev
3234c924cf disable compression on static files 2021-01-21 06:46:54 +03:00
The-EDev
b72ee2a4e8 Added virtual destructor to fix clang compilation 2021-01-15 03:45:57 +03:00
The-EDev
cf217d3c1f Merge branch 'master' 2021-01-05 17:51:57 +03:00
The-EDev
33f1206571 made json a returnable type and removed json specific code 2021-01-05 17:49:10 +03:00
The-EDev
24fc57d453 location != "" -> !location.empty() 2021-01-03 17:56:19 +03:00
The-EDev
09d0f4ccdd Added HTTP compression using gzip or deflate (disabled by default, requires calling method) 2021-01-02 22:12:04 +03:00
The-EDev
97dea47eb0 Changed the behaviour of redirect function to redirect to a route if no http:// is available
Also added `redirect_perm`, `moved`, and `moved_perm` functions with their status codes.
And corrected the description of the `raw_url` member.
2020-12-26 19:54:41 +03:00
Nick Rizzo
3945251869 [fix] Make signal handler optional 2020-12-19 14:05:27 -05:00
The-EDev
9db47120e7 added documentation
also removed extra header meant for testing
2020-12-19 14:30:20 +03:00
The-EDev
ed2a7ae0e0 Added returnables class and applied to multipart
did not apply to JSON because it caused a linker error
also changed the version of boost required in CMAKE
2020-12-18 12:28:37 +03:00
Ayaan Khan
716aa046fc
Merge branch 'master' into master 2020-12-03 12:46:57 +05:30
Makaveli
9bc030478f Settable server name feature 2020-12-02 20:15:05 -05:00
ayaankhan98
ec29121c22 fix clang build 2020-12-02 22:59:45 +05:30
ayaankhan98
fcce57d232 revert: new handler_ changes 2020-12-02 16:37:43 +05:30
ayaankhan98
770359e79f fix: ambigous call and example 2020-12-02 15:36:29 +05:30
ayaankhan98
737a3384ae removed extra changes 2020-12-01 14:39:11 +05:30
ayaankhan98
6f31e597a0 Merge branch 'master' of https://github.com/ayaankhan98/crow 2020-12-01 12:36:09 +05:30
ayaankhan98
acab73ef68 removed extra req arg 2020-12-01 12:35:46 +05:30
Ayaan Khan
6c7bef1eda
Merge branch 'master' into master 2020-12-01 12:03:02 +05:30
ayaankhan98
a7c74c6327 recieve response without request being another argument in handle 2020-12-01 11:50:46 +05:30
The-EDev
3d202d2919 allow returning all json data types, not just json objects 2020-11-26 04:08:24 +03:00
The-EDev
2422f55855 documented as much as possible relating to the API reference 2020-11-19 01:13:57 +03:00
The-EDev
454810c165 Added reference docs for dumb_timer_queue, http_request, http_response, and socket_adaptors 2020-11-14 05:28:07 +03:00
Farook Al-Sammarraie
f9dec6997e
Merge branch 'master' into static_file_win32 2020-11-13 15:24:44 +03:00
Eero Pajarre
71bd6c8c2b removed another if not defined(_WIN32) 2020-11-13 07:42:02 +02:00
Eero Pajarre
16cae0af4a Activate static_file support on WIN32
static_file support seems to work, at least with
Microsoft Visual Studio 2017 and 2109 / C++17.
Without it the compilation fails, so activating it.
2020-11-12 15:38:37 +02:00
Eero Pajarre
5fe3a45793 Replaced uint with unsigned
uint is not a default type in C++.
Replaced it with unsigned, which should be large enough
2020-11-12 15:11:22 +02:00
The-EDev
384baaade4 moved middlewares folder inside crow folder
also fixed an issue where by default nothing is included
2020-11-11 23:43:57 +03:00
Farook Al-Sammarraie
7c88cdbb60
Merge branch 'master' into middleware_reorganizing 2020-11-11 22:44:43 +03:00
The-EDev
6444748269 separated middlewares from core code
modified merge script to include middlewares, all are included by default
include excludes everything else (items separated by ',')
exclude only excludes selected items (items separated by ',')
2020-11-11 05:39:57 +03:00
The-EDev
24830648d2 added macros for static endpoint and directory
(also put some info in the example)
2020-11-10 23:56:27 +03:00
Farook Al-Sammarraie
50670c290b
Merge branch 'master' into static_dir 2020-11-10 12:34:04 +03:00
The-EDev
c4d191a7b0 added static/ prefix to path 2020-11-10 03:54:30 +03:00
The-EDev
72aeabd5e4 added default "/static/<path>" route for any static files
can be disabled via CROW_DISABLE_STATIC_DIR def
2020-11-10 03:47:30 +03:00
The-EDev
fab2640702 Ping and Pong messages shouldn't fail with messages larger than 127 bytes anymore
Has the added advantage of making the code look more consistent, while sacrificing some performance (very little though)
2020-11-09 17:36:03 +03:00
The-EDev
b54b5a4c6e obligatory simple messup fix
removed extra is_open method
2020-11-09 05:18:34 +03:00
The-EDev
ca46844782 Added check for SSL adaptor to fix potential crash when SSL websockets are used (ipkn#328) 2020-11-09 05:00:49 +03:00
The-EDev
5c7ef21211 websocket improvements
replaced base10 bits to base8 in comments
added send_ping and send_pong to API (users can now send them)
reset header value before every read
2020-11-09 04:41:55 +03:00
The-EDev
8dc61959f2 added method to send ping message 2020-11-05 04:10:33 +03:00
The-EDev
463917a17f added option to have unmasked messages 2020-11-04 07:16:03 +03:00
The-EDev
cc715f4245 cleaned up app.h documentation 2020-11-04 06:21:52 +03:00
The-EDev
777dfa31af added documentation and illustration from RFC 6455 2020-11-04 06:20:09 +03:00
The-EDev
4a42a6fbae bump server version to 0.2
also fixed a chmod issue in travis
2020-10-31 23:56:50 +03:00
Farook Al-Sammarraie
5b996e4686
Merge pull request #33 from mrozigor/stream-fixes
Stream fixes
2020-10-31 21:10:41 +03:00
The-EDev
fc0c6d9eae removed reserve code 2020-10-31 03:09:32 +03:00
Igor Mróz
90b46528d4
#6 Fix mustache implementation after specification update. 2020-10-30 20:29:41 +01:00
Farook Al-Sammarraie
81386da246
Merge branch 'master' into stream-fixes 2020-10-27 16:28:01 +03:00
The-EDev
92d7f2e3c4 optimized the body streaming code
has the side effect of removing some messups I made
2020-10-27 16:21:52 +03:00
The-EDev
0a21fcbba0 split streaming methods to allow streaming strings as well as streams 2020-10-27 02:36:02 +03:00
The-EDev
c3220a73bc documented most of app.h 2020-10-22 04:13:57 +03:00
Farook Al-Sammarraie
bbada35cb1
Merge branch 'master' into configure-timeout 2020-10-21 23:52:37 +03:00
Farook Al-Sammarraie
c66afeb4d3
Merge branch 'master' into stream_body 2020-10-21 23:29:18 +03:00
Farook Al-Sammarraie
1e05fa5447
Merge branch 'master' into configure-timeout 2020-10-21 22:51:20 +03:00
Farook Al-Sammarraie
c4dba56f32
Merge branch 'master' into stream_body 2020-10-21 22:51:16 +03:00
Farook Al-Sammarraie
179114b3c6
Merge branch 'master' into connection-improvements 2020-10-21 22:51:11 +03:00
The-EDev
e1650750ce fixed typo 2020-10-21 20:56:12 +03:00
The-EDev
9728d652df changed megabyte name to res_stream_threshold_ 2020-10-21 20:54:28 +03:00
Farook Al-Sammarraie
019ead45e2
Merge branch 'master' into stream_body 2020-10-21 19:50:01 +03:00
Farook Al-Sammarraie
70887d88c3
Merge branch 'master' into travis-changes 2020-10-21 19:42:34 +03:00
Igor Mróz
548510ad80
Merge branch 'master' into connection-improvements 2020-10-21 18:41:05 +02:00
Farook Al-Sammarraie
acd94fca37
Merge branch 'master' into configure-timeout 2020-10-21 19:39:51 +03:00
The-EDev
1b284e21b1 removed unneccessary class reference 2020-10-21 16:31:06 +03:00
The-EDev
d04947980d Added method to set timeout (default is 5 seconds) 2020-10-21 16:06:49 +03:00
The-EDev
bcd135fad6 set connection to stream any respose body larger than 1MB
using the same system for static file serving
2020-10-21 04:02:09 +03:00
The-EDev
cdd613935d removed char <=0 comparison
(not sure why it invoked an error in ARM now)
2020-10-20 12:17:00 +03:00
The-EDev
63ea212e1a shutting down socket before closing the connection 2020-10-20 11:48:35 +03:00
The-EDev
745f6c95c6 changed verification option to verify once (#17) 2020-10-20 11:43:43 +03:00
Farook Al-Sammarraie
65b12e88e8
Merge branch 'master' into multipart 2020-10-20 10:10:52 +03:00
Igor Mróz
942fcd1bc9
Check if number of threads is valid. 2020-10-19 19:26:46 +02:00
Igor Mróz
b6f8e805ff
Fix friend declaration. 2020-10-19 18:55:40 +02:00
Igor Mróz
603ceb377a
Remove debug statements. 2020-10-19 18:32:16 +02:00
Igor Mróz
e1085de237
README cleanup. Tests cleanup. 2020-10-19 18:32:16 +02:00
Igor Mróz
7b8b72bd11
Remove conanfile. Update mustache specification jsons. Remove compilation warnings. Update CMake version. Change test framework to Catch2. 2020-10-19 18:32:16 +02:00
The-EDev
cb0915901f cleaned up code 2020-10-18 03:04:18 +03:00
The-EDev
e06942dfc4 added test
funny enough, the test pointed out a mistake i made in the code XD
2020-10-18 02:36:39 +03:00
The-EDev
d20bc7051a removed include for mime type header 2020-10-18 01:56:07 +03:00
The-EDev
b49d52e78b Added basic multipart data structure
Including methods to generate multipart message from request
2020-10-18 01:34:58 +03:00
The-EDev
823d061c62 Removed unnecessary variables 2020-10-15 13:59:15 +03:00
The-EDev
4e5d43696b code formatting
Removed extra spaces
2020-10-15 00:09:35 +03:00
The-EDev
dc46f2848a added 405 error for when a rule is found but the method is incorrect 2020-10-15 00:09:17 +03:00
The-EDev
5382ce7b58 Update http_connection.h 2020-10-13 00:53:27 +03:00
The-EDev
99994d90b5 Edited lambda for sending error 2020-10-12 14:07:34 +03:00
The-EDev
964e8f857b removed sendfile function due to trouble with large files (the sendfile command would just hang until timeout without fully sending the file).
Added 404 and fixed some issues with windows error message
sendfile still incompatible with windows due to the stat function
also changed the buffer size to 16KB
2020-10-11 19:00:24 +03:00
The-EDev
4992261f0e fixed mime type issue, added default plaintext option 2020-10-11 00:54:20 +03:00
The-EDev
8f9486e3c8 added initial chunk sending code (for SSL only) 2020-10-11 00:29:40 +03:00
The-EDev
7ba3c9161f fixed type mismatch issue when using SSL 2020-10-09 16:01:24 +03:00
The-EDev
744baf8c0a Refactored mime type generating script
using with instead of open and close
removed while loop
using one line to write the new file
using unordered map instead of ordered map
added indentation to the generated file
2020-10-07 12:17:37 +03:00
Farook
24c04c65cf updated generated file comment 2020-10-04 19:17:58 +03:00
Farook
7e812ea58a removed content-type related comments 2020-10-04 19:14:13 +03:00
Farook
dd79b31274 added automatic Content-Type header based on file extension 2020-10-04 19:11:18 +03:00
Farook
3f38caa0d0 stole @digitalist's sendFile code and made it work with newer boost 2020-10-04 15:05:26 +03:00
Igor Mroz
b6003f5c6a
Merge pull request #2 from nowgoing/master
Update websocket.h function "void do_read()"
2020-08-24 21:00:05 +02:00
SQyang
0cb9330125
Update websocket.h 2020-08-24 19:47:30 +08:00
SQyang
215b7dcf35
Update websocket.h 2020-08-13 13:18:16 +08:00
Igor Mroz
1a92344dd4
Merge pull request #1 from moneroexamples/fix_boost_170
fixes problem with boot 1.70
2019-11-05 18:59:00 +01:00
moneroexamples
c95f68499e fixes problem with boot 1.70 2019-07-01 14:49:10 +08:00
Igor Mróz
741ba25abf Merge branch '#146_add_ip_address_field' 2018-09-28 21:24:06 +02:00
Igor Mróz
ef7fa91631 #146 Added field with remote IP address. 2018-09-28 21:16:36 +02:00
Igor Mróz
809453f9d5 #315 Checking if server is nullptr. 2018-08-30 17:51:54 +02:00
Jaeseung Ha
49edf898a5
Merge pull request #274 from mwm126/mingw-gmtime_s
Use gmtime_s on MinGW
2017-12-27 23:33:31 +09:00
ipknHama
d1a30bf422 Avoid exceptions while closing sockets 2017-12-25 22:36:30 +09:00
ipknHama
05d02fea6e Remove printf warning for lld, llu 2017-12-25 16:26:30 +09:00
ipknHama
b7360a2bac Support multiple methods for same URL
- fix broken unittests because of server initializing order change
 - add a function to wait until server is up
2017-12-25 15:31:20 +09:00
ipknHama
daa1e3eadc Add PURGE method, add a special enum item for counting 2017-12-25 15:31:20 +09:00
Jaeseung Ha
6876a08e61
Merge pull request #260 from erikaldsund/fix_rvalue_copy_ctor_bug
Fixed bug in json::rvalue copy constructor
2017-12-25 15:31:11 +09:00
Jaeseung Ha
943dcba507
Merge pull request #259 from erikaldsund/fix_r_string_inconsistency
Fixed bug in r_string
2017-12-25 15:30:32 +09:00
Jaeseung Ha
01cc7a3508
Merge pull request #258 from erikaldsund/fix_handling_of_big_integers
Fix handling of big integers
2017-12-25 15:30:06 +09:00
Mark Meredith
6974d3fcf9 Use gmtime_s on MinGW 2017-12-24 12:38:52 -05:00
Jaeseung Ha
49bd1c2797
Merge pull request #261 from erikaldsund/fix_warning_in_websocket_h
Fixed warning in websocket.h: right shift count >= width of type
2017-12-25 02:29:25 +09:00
roxma
f0eb73ce8c Fix ws read failure when using 16bit payload
Also should use ntohs instead of htons when read from socket.
2017-12-22 17:53:51 +08:00
Erik Åldstedt Sund
3c45393b2d Don't call copy_l before all other members are set
This lead to undefined behaviour during copy.
2017-10-30 20:51:44 +01:00
Erik Åldstedt Sund
29824c84ed Fixed bug in r_string: end of string pointer was not updated in the force member function
This could lead to undefined behaviour in the std::string conversion
operator, when using the iterator interface (begin() / end()), and the size()
member function.
2017-10-30 20:50:17 +01:00
Erik Åldstedt Sund
ecbbd0ebf2 Fixed ostream operator for big integers 2017-10-30 20:47:48 +01:00
Erik Åldstedt Sund
4fe7dd171a Handle big integers in json::wvalue
Handled by adding an enum num_type in both rvalue and wvalue (to separate
between signed/unsigned ints, and floating point values) and a union for
the number value in wvalue.
2017-10-30 20:47:48 +01:00
Erik Åldstedt Sund
83bd8c09a0 Fixed warning in websocket.h: right shift count >= width of type
Fixed by static_cast-ing values from 32-bit values to 64-bit values.
2017-10-30 20:45:34 +01:00
Jaeseung Ha
7f3f72441c Merge pull request #253 from boodkb/patch_method
Add support for HTTP PATCH method
2017-10-21 20:51:35 +09:00
Simon Rasmussen
f88657a22a Added 413 and 429 status codes 2017-10-20 15:20:18 +02:00
BooD
8b01385465 Add HTTP PATCH support 2017-10-05 18:13:40 +03:00
ipknHama
7560f329c9 Remove unused include. 2017-09-18 04:43:51 +09:00
ipknHama
2c26b6c1de Change default settings
- disable crow debug mode by default
 - expose `loglevel` method on `App` to change the logging level easily
 - add a startup message that guides how to change the logging level
2017-09-18 02:58:53 +09:00
ipknHama
e93ba25f2c Fix cookie parsing: Cookie doesn't have escaping mechanism. 2017-09-18 02:39:46 +09:00
ipknHama
9c26e1ebde Simplify json.keys() 2017-09-18 01:21:18 +09:00
Jaeseung Ha
08acc7c0be Merge branch 'master' into master 2017-09-18 00:43:42 +09:00
Jaeseung Ha
d8c4a67176 Merge branch 'master' into master 2017-09-17 19:17:54 +09:00
Jaeseung Ha
4786dac0a8 Merge pull request #193 from vadz/show-concurrency
Show the number of threads used in the startup message
2017-09-17 18:31:24 +09:00
Jaeseung Ha
112e86b906 Merge pull request #194 from vadz/atomic-conn-count
Use atomic type for connection count shared between threads
2017-09-17 18:30:24 +09:00
Jaeseung Ha
c32aae4b5f Merge pull request #183 from philave/vs2015-compilation-fix
MS VS2015 compilation fix.
2017-09-17 18:29:52 +09:00
Jaeseung Ha
ef17b8cb9b Merge branch 'master' into master 2017-09-17 18:01:57 +09:00
ipknHama
c071f64376 Delete new connection with error while accepting (kwangsei, PR #205) 2017-09-17 14:13:33 +09:00
Jaeseung Ha
f0cb83df88 Merge pull request #210 from zxmarcos/master
Add onaccept handler to websocket rule
2017-09-17 14:17:46 +09:00
Jaeseung Ha
cf67a40e4c Merge pull request #212 from uctakeoff/fix_warning_in_cpp11
Fixed a problem that warning appeared in c ++ 11
2017-09-17 14:10:07 +09:00
ipknHama
92bea9e949 Change vector to unordered_map for get_dict 2017-09-17 14:02:46 +09:00
ipknHama
f35089b2aa Add missed header file. 2017-09-17 13:47:05 +09:00
Jaeseung Ha
13fdc9390b Merge pull request #202 from Rasie1/master
Conflict with std namespace
2017-09-17 13:50:50 +09:00
ipknHama
69a17f066b Fix #245. Trying to keep serving after an exception in the handler. 2017-09-17 12:45:13 +09:00
Jaeseung Ha
2564c62778 Merge pull request #229 from JaewooSeo/wvalue_vector
wvalue (json) support vector<wvalue>
2017-09-17 12:40:05 +09:00
Jamie Bullock
679fe4a8ac Add support for HTTP 422 status code
See: https://tools.ietf.org/html/rfc4918#section-11.2
2017-09-04 16:40:40 +01:00
Jamie Bullock
9a1e4aefdd Revert "Add support for HTTP 422 status code"
This reverts commit 6e4e66ad12.
2017-09-04 16:38:51 +01:00
Jamie Bullock
6e4e66ad12 Add support for HTTP 422 status code
See: https://tools.ietf.org/html/rfc4918#section-11.2
2017-09-04 16:08:02 +01:00
jaewoo.seo
777852c97d wvalue (json) support vector<wvalue> 2017-05-12 11:43:27 +09:00
Rasie1
01b21296bc Add get_dict method 2017-03-16 19:25:27 +03:00
ushiyake
bd2dd4a8e4 Fixed a problem that warning appeared in c ++ 11 2017-01-09 21:24:01 +09:00
Marcos Medeiros
bea1ba3797 Add onaccept handler to websocket rule 2016-12-28 11:06:56 -02:00
Vsevolod Kvachev
32d66d6fd1 Upgrade amalgamate 2016-12-06 18:22:10 +03:00
Sergiu Giurgiu
c63113f825 Removed strict-aliasing warning 2016-12-04 14:03:20 -05:00
Vadim Zeitlin
bd9a9ace4a Use atomic type for connection count shared between threads
Even if this variable is only used in debug mode, it's still bad to have data
races on it, as it was the case (and reported by thread sanitizer) before.
2016-11-15 16:44:45 +01:00
Vadim Zeitlin
34b050ee8f Show the number of threads used in the startup message
This can be useful, especially when using the default hardware concurrency, to
see how many threads does the server actually use in the logs.
2016-11-15 16:33:14 +01:00
Philip
366e7c7e4b MS VS2015 compilation fix. It’s better to use native Win32 (strncpy_s, sprintf_s) to avoid compilation errors when building by MS C++. 2016-10-21 18:22:24 +03:00
Taylor King
26c4d5ddef implement .keys() 2016-10-10 06:10:01 -04:00
yorickdewid
e40605da59 HTTP response redirect
- Log address
2016-10-03 15:32:16 +02:00
yorickdewid
f4f6b02403 Set cast type without dereferencing pointer 2016-10-03 13:47:22 +02:00
ipknHama
3081e4e1a8 Cleanup include folder into crow subfolder
- only crow.h is exposed now
2016-09-21 23:11:06 +09:00
ipknHama
7af78aff5a Fix bugs in websocket
- `Upgrade: websocket` should be case-insensitive
 - Using network byte order for length field
2016-09-15 17:29:08 +09:00
ipknHama
5ae0dffddf Add a field to websocket::connection for storing user data 2016-09-10 02:39:22 +09:00
ipknHama
d07a26f3f8 Closing behavior change; should help #151 2016-09-10 02:13:50 +09:00
ipknHama
7d428f4265 Remove meaningless debug log 2016-09-10 02:13:13 +09:00
ipknHama
031f850b94 Add inline to avoid unused function warning 2016-09-10 01:25:49 +09:00
ipknHama
a1a587784e Add missing dependency (for amalgamate) 2016-09-10 01:22:06 +09:00
ipknHama
8a4b126ea6 Add a function which loads plain text file from templates folder 2016-09-10 01:22:06 +09:00
ipknHama
079df6efc5 Add a periodic handler feature 2016-09-10 01:22:06 +09:00
Eugene Timokhov
0a9418b307 Fixed missing static keyword for non-template functions 2016-09-07 01:09:08 +03:00
Jaeseung Ha
43c9b09345 Add dependent header 2016-09-06 09:39:45 +09:00
Jaeseung Ha
800d31411d Fix issue #89 2016-09-06 09:39:13 +09:00
Eugene Timokhov
f3350597a3 Fixed crow::json::detail::r_string move operator 2016-09-04 03:33:49 +03:00
ipknHama
967adf0de5 Add websocket feature 2016-08-28 14:46:31 +09:00
ipknHama
f88b56dff0 Add u() for uint64_t: manually applying #129 2016-08-27 18:12:17 +09:00
ipknHama
e161da45e0 Remove warnings: manually applying #101, #104 2016-08-27 18:03:49 +09:00
ipknHama
9e851ec896 Handling macro issues
- fix IS_NUM conflict (for MySQL)
 - avoid DELETE, ERROR (for Windows)
2016-08-27 14:15:16 +09:00
rayburgemeestre
ee220daeef expose server stop() in Crow app to allow shutdown other than signal. 2016-06-19 12:50:40 +02:00
ipknHama
c164db353b fix warning (initializing order of bind_addr_) 2016-05-23 22:04:09 +09:00
Jaeseung Ha
cb5ef23ef0 Merge pull request #107 from kumagi/master
defeat some warnings
2016-05-23 21:52:37 +09:00
Jaeseung Ha
eb5a3b55f9 Merge pull request #126 from gmaisto/master
Added support to bind to a specific interface
2016-05-23 21:51:30 +09:00
Jaeseung Ha
f96f65938d Merge pull request #113 from pierobot/master
Added inline to get_type_str
2016-05-23 21:47:47 +09:00
Gino Maisto
1b1210685e Bind to interface support: fixed unittest 2016-03-19 16:05:48 +01:00
Gino Maisto
e5d73b4c53 Added support to bind to a specific interface 2016-03-14 19:43:45 +01:00
Jaeseung Ha
975205075d Merge pull request #123 from pierobot/fix-corrupt-buffers
Fix corrupt buffers
2016-03-14 19:46:21 +09:00
pierobot
7712b8b8e0 Fix misspell of Connection 2016-03-07 17:30:19 -06:00
pierobot
dbd7c2fbe0 tab to space 2016-03-07 17:22:35 -06:00
pierobot
f57d257dc6 Fix buffer corruption bug
https://github.com/ipkn/crow/issues/122
2016-03-07 17:21:19 -06:00
pierobot
34112749eb Added inline to get_type_str 2016-01-12 13:43:16 -06:00
kumagi
47673eaddc defeat some warnings 2015-12-24 20:42:21 +09:00
Samuel Marks
37085e09c4 [Feature] JSON body i() now works with strings. Added better error messages also. 2015-09-27 14:36:08 +10:00
Samuel Marks
55dd19eb81 [Feature] JSON response can now include status code 2015-09-27 13:33:09 +10:00
Jaeseung Ha
e4708671bc implement HTTPS support
- define CROW_ENABLE_SSL to use
 - close #88
2015-09-20 22:06:00 +09:00
Dmitry Ledentsov
070d099a1c Update crow.h 2015-07-26 20:59:44 +02:00
ipknHama
5b72a09973 fix multithread bug occurs while accepting new connection 2015-05-27 14:47:51 -04:00
ipkn
4f5e36f927 Merge pull request #60 from sivachandran/master
Fix for linker symbol redefinition errors when crow header is included in multiple source files
2015-05-09 23:32:42 +09:00
Bryce Anderson
243995f36f Fix memory error and invalid param when no params are present
Also added a unit test that fails with the previous behavior.
Note that `-fsanitize=address` exposes the invalid memory access in
qs_parse.
2015-04-30 20:56:28 -04:00
Siva Chandran
a0ffd76e9c Made all parameter_tag related functions into static inline instead of constexpr. 2015-04-25 12:07:24 +05:30
Siva Chandran
e99cec63a1 Made parameter_tag related functions to constexpr/static to avoid linker symbol redefinition error when crow header is included in multiple cpp files. 2015-04-25 11:54:22 +05:30
Gabriel Marinho
441a9f6e61 Revert "Suggestion: Change the server name variable to a constant on settings.h"
This reverts commit 100f4a7b73.
2015-04-13 18:51:32 -03:00
Gabriel Marinho
100f4a7b73 Suggestion: Change the server name variable to a constant on settings.h
With this constant is very more easy to change the Crow server name.
2015-04-13 18:43:24 -03:00
Gabriel Marinho
b7a7df0412 Fix Content-Type not setted passing JSON object by rvalue reference.
In this specific case, Crow is not setting the JSON Content-Type and this is causing "not well-formed" exception in the Firefox browser.
2015-04-13 01:23:45 -03:00
ipkn
028cd0ecc0 Merge pull request #53 from JaewooSeo/vs2013
VS2013 x64 build support
2015-03-18 22:39:41 +09:00
jaewoo.seo
f0f5b223f0 VS2013 x64 build support 2015-03-15 17:51:55 +09:00
Jonas Westerlund
13b8a70c51 Fix parameter typos 2015-03-12 14:53:45 -07:00
ipknHama
48811ce4a4 remove thread_local variables
* move thread_local variables forget_cached_date_str, timer_queue
   into each threads local stack
2015-02-20 13:44:46 +09:00
ipknHama
5507e98ce2 fix tab to space 2015-02-20 12:00:15 +09:00
ipknHama
3a5599e61a refactor DynamicRule and TaggedRule to support common pattern
* name, methods
2015-02-20 11:58:41 +09:00
ipknHama
0a7c997349 working on VS2013 support
* wrap constexpr
 * add run-time version of get_parameter_tag
2015-02-20 11:50:34 +09:00
ipknHama
02f81f7eaa add CROW_MSVC_WORKAROUND and CROW_CAN_USE_CPP14 macro 2015-02-20 11:47:23 +09:00
ipknHama
92cf40e053 change gmtime to the safer version 2015-02-20 11:07:23 +09:00
ipknHama
f1d1fd6480 change 0b literals to 0x for VS2013 support 2015-02-20 10:54:32 +09:00
ipknHama
7fe8e2cfdc change SFINAE mechanics to support VS2013 2015-02-20 10:53:43 +09:00
ipknHama
5d8d527639 add run-time check for handler type for route_dynamic 2015-02-19 12:16:28 +09:00
ipknHama
d564d486b5 added route_dynamic 2015-02-19 00:57:01 +09:00
Jaeseung Ha
07042b55fd fix #27 : handling routes with trailing slash 2015-01-19 19:03:06 +09:00
Jaeseung Ha
b5942c4dda add member initialization:
need_to_call_after_handlers_
2015-01-19 18:59:55 +09:00
Jaeseung Ha
e27de5edac add const to request::get_header_value method 2015-01-19 18:58:19 +09:00
ipknHama
3fc1424e62 fix issue #39, bug at assigning vector to json wvalue 2015-01-08 08:22:06 +09:00
ipknHama
f6fdf68fe2 Merge branch 'try-catch-handle' of https://github.com/acron0/crow into acron0-try-catch-handle
Conflicts:
	amalgamate/crow_all.h
2014-12-12 07:29:08 +09:00
ipknHama
966867a9ca change pointer to reference; fix up spaces 2014-12-12 01:38:57 +09:00
Antony Woods
c2f75a7de1 Merged upstream 2014-12-10 17:29:31 +00:00
Antony Woods
a1751967c3 Added a general purpose try-catch around handle() for instances where an exception would cause the server to never return a response. At some later date we would possibly still wish to provide a custom hook for dealing with 500s. Also note, after an exception is caught, the generated 500 response is still sent to middleware handlers 2014-12-10 17:24:13 +00:00