Commit Graph

98 Commits

Author SHA1 Message Date
Farook Al-Sammarraie
ab50fb3134
Merge branch 'master' into parser_optimization 2022-02-11 00:46:19 +03:00
The-EDev
155cf759eb
fixed issue where absolute unix paths were not sanitized 2022-02-08 19:11:46 +03:00
The-EDev
175b004c26
code formatting (also disabled formatting where not applicable) 2022-02-06 22:29:46 +03:00
The-EDev
15908e5498
fixed problem with compression test 2022-02-06 21:01:22 +03:00
The-EDev
75b100527f
Merge branch 'refs/heads/master' into parser_optimization 2022-02-05 18:35:01 +03:00
The-EDev
4cdde73388
Optimized HTTP parser
Also (likely) fixed problem with streaming without keeping connection
alive
Also fixed problem with multipart hanging on request
Also updated TODO entries to indicate Writer
2022-02-05 18:15:19 +03:00
Thomas Neumann
74e5fa8c87 improve sanitize_filename
The old implementation allocated a new string for every invocation, and
repeatedly scanned the string for occurences of the various Windows device
names. This commits resizes the original string instead if needed, and
detects all devices with a single pass.
2022-01-24 08:08:20 +01:00
Thomas Neumann
15085a9f95 avoid memory allocation in base64decode
Every single call to base64decode allocates a mapping table for all
base64 characters. This is quite wasteful, as the map is in fact static.
We could use a static variable here, but that would have unpleasant consequences
if we ever encounter input with non-valid base64 characters (which
implicitly modifies the map).

The number of character ranges for base64 is quite low (3, plus 4 exceptions),
thus we can simply check that explicitly in code instead of using a dynamic hash table.
2022-01-24 07:24:34 +01:00
The-EDev
228e61d150
Added mustache lambda expansion 2021-12-10 05:17:25 +03:00
Luca Schlecker
7e4f1494d2 improved lambda bracing by inlining only empty lambdas.
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2021-11-27 19:22:35 +01:00
The-EDev
03e59aa446
improved bracing rules, commented out clang-format 14 rule 2021-11-27 15:28:50 +03:00
The-EDev
7f4b7c8ff9
created new rules, used bot to enforce rules in PRs 2021-11-25 14:45:38 +03:00
The-EDev
65f8eb9e44
added macro to enforce ws spec and added 16/64 bit payload length unit tests for ws 2021-11-22 17:39:48 +03:00
Luca Schlecker
e5c7daccce remove every occurance of #define CROW_MAIN.
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2021-11-21 17:25:16 +01:00
Luca Schlecker
6458184e8f task_timer: rename set_timeout to schedule.
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2021-11-20 17:03:58 +01:00
Luca Schlecker
403d0dcffd add unit test for task_timer.
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2021-11-20 16:56:26 +01:00
Luca Schlecker
b47e0adcf7 add unit test for server timeout.
Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2021-11-17 19:42:36 +01:00
Farook Al-Sammarraie
7f8629075d
Added newline to end of unittest.cpp 2021-11-15 15:52:33 +03:00
Florian Rupprecht
5bb7fac016 Get app port 2021-11-14 13:04:19 +01:00
Farook Al-Sammarraie
05a4b82bd5
Merge branch 'master' into http09_get_only 2021-11-02 00:00:03 +03:00
The-EDev
9b3f83a06f
Fixed issue in Test message formulation 2021-11-01 21:10:45 +03:00
The-EDev
ed8d1ebaaa
Added checks for GET on HTTP/0.9 and any other errors
Earlier behavior only checked whether every byte was parsed, which isn't
ideal

Signed-off-by: The-EDev <farook@the-e-dev.com>
2021-11-01 12:02:25 +03:00
The-EDev
576f90a0e4 Added Base64 decoder function and Base 64 unit tests 2021-10-31 02:50:19 +03:00
The-EDev
9667e17a40 fixed bug introduced in last commit 2021-10-06 13:51:17 +03:00
The-EDev
71639b6046 added named constants 2021-10-06 13:32:35 +03:00
The-EDev
85e9787575 changed the way "stream_response" test handled incoming data
This will either fix the issue (223), be generally better than the previous way the test was conducted, or change the failure rate from 70% to 100%
2021-10-05 15:13:38 +03:00
Luca Schlecker
989ae6a6cd disable compression test if configured without enabling compression support. 2021-09-01 09:29:12 +02:00
Luca Schlecker
28acb2c5a7 rework cmake configs.
See #160 for more info.
2021-09-01 09:29:02 +02:00
hg333
ff07c2b867 removed get_header 2021-08-30 15:43:33 +05:30
hg333
249114ab29 added tests for Content-Type 2021-08-30 15:31:50 +05:30
hg333
f07e37c775 added unit tests 2021-08-30 12:17:08 +05:30
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
Lucas David
6ae3025bd6 - Removed useless comments. 2021-08-12 09:31:27 +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
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
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
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
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
Farook Al-Sammarraie
1654acbfd0
Merge branch 'master' into HEAD_and_OPTIONS 2021-04-03 06:31:45 +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
Maxim Kokryashkin
cdce8f443a macro rename 2021-03-31 20:30:32 +03:00
Maxim Kokryashkin
ce7d08eb0e fixed issues with static wariables 2021-02-21 00:28:32 +03:00
The-EDev
747ad6db72 Merge branch 'master' 2021-01-21 21:37:55 +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
09d0f4ccdd Added HTTP compression using gzip or deflate (disabled by default, requires calling method) 2021-01-02 22:12:04 +03: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
The-EDev
5d23b2b9c7 fixed testing issue 2020-11-11 13:51:29 +03:00
The-EDev
76af416766 added websocket unit test 2020-11-09 04:47:41 +03:00