Commit Graph

197 Commits

Author SHA1 Message Date
AndreyTokmakov 1b6a4f4301 Get rid of unnecessary string copies in the the keys() method 2024-05-06 14:20:22 +02:00
bugdea1er e3ff9238a4 Add option to use Boost.Asio 2024-04-19 17:06:13 +02:00
Tristan CADET d0f1991e38 fix: parse body when unsupported HTTP/2 upgrade is requested
Crow does not support HTTP/2 at the moment.
According to the RFC https://datatracker.ietf.org/doc/html/rfc7540#section-3.2
"A server that does not support HTTP/2 can respond to the request as though the Upgrade header field were absent"
2024-03-17 15:02:25 +01:00
sina-rostami 106aeb0f0d Add indentation to json dump method
Closes #747
2024-03-10 21:41:43 +01:00
Corentin Schreiber 049490c2c9
Add configurable exception handler (#637)
* Added exception_handler()

* Fixed worker crash if exception thrown in catch-all handler
2024-03-10 13:52:13 +01:00
StefanoPetrilli 8f7e28ef91 adds new tests 2024-03-10 13:11:56 +01:00
StefanoPetrilli 00bd06d6d3 update existing tests 2024-03-10 13:11:56 +01:00
June Han 5ecd04ade2 fix: call after_handlers for legitimate requests without body part 2024-02-21 21:37:51 +01:00
JuneHan 973d5fa1cd
fix: minimize the precision loss when dumping double to string (#712)
* fix: minimize the precision loss when dumping double to string
* abandon one-time macro
* replace hard-coded buffer size, replace `sprintf` with `snprintf`
* replace `DECIMAL_DIG` with `DBL_DECIMAL_DIG`
* Update json.h changed to C++11 DECIMAL_DIGIT
* added cfloat include
* identify float and double as different numeral types, and approach their precisions accordingly

---------

Co-authored-by: June Han <jun_h@pretia.co.jp>
Co-authored-by: gittiver <gulliver@traumkristalle.net>
2024-01-29 15:25:26 +01:00
Gulliver 17034adae5 on all platforms added CROW_FEATURES ssl, compression and needed libs to prerequisites
general tests are now enabled on MSVC, mustachetests disabled due to some strange bug in python script (will be done later)
2024-01-07 16:04:38 +01:00
keith-dev 6aed71e3c4
fix build: android/termux/clang-17.0 (#736)
* fix build: android/termux/clang-17.0

* Android build links with liblog in places
2024-01-04 10:46:21 +01:00
Stefano Petrilli 3b81e16614
Validate if the CROW_ROUTE starts with a '/' (#559) (#597) 2023-05-05 16:00:18 +02:00
Gabriel Feyer ee0d2f9dd0 Fix typo in unit test 2023-02-23 16:10:30 -05:00
queenstdev b493cd646e fix #587 Render true and false Mustache tags 2023-02-03 21:34:38 +01:00
Simon Oehrl d0929ae66d Fix formatting 2022-11-23 13:37:34 +01:00
Simon Oehrl 8b34504741 Use const string reference instead of string_view 2022-11-23 13:37:34 +01:00
Simon Oehrl cec165e29a Adapt CROW_WEBSOCKET_ROUTE to accept app reference 2022-11-23 13:37:34 +01:00
Jake Arkinstall 0b90bb486c
Address #534 - handling missing mime types gracefully (#536)
* Added tests for content-type to mime-type detection.

Added a custom_content_types test case that verifies that a user can
specify the mime-type through the contentType parameter upon creation
of a response. If their contentType does not appear in the mime_types
map, but looks like a valid mime type already, it should be used as the
mime type.

Validating against the full list of valid mime types
(https://www.iana.org/assignments/media-types/media-types.xhtml)
would be too intensive, so we merely verify that the parent type
(application, audio, font, text, image, etc) is a valid RFC6838
type, and that the subtype is at least one character. Thus we can
verify that custom/type fails, and incomplete strings such as
image/ and /json fail.
2022-09-12 14:16:16 +03:00
The-EDev 1e0efb0b8b
Added unittest for Host header 2022-08-22 22:32:22 +03:00
The-EDev 0aa3ab94be
fixed unit-tests and warnings 2022-08-22 00:38:03 +03:00
erik e3f5c5924c Fix compilation error: ambiguous overload
On gcc 5.3.0, you get a compilation error when assigning a lambda
function to a json::wvalue. The compilation error is due to a lambda
function being implicitly convertible to a function pointer, which again
can be implicitly converted to both a bool and a std::function. Avoid
the ambiguity by explicitly casting the lambda to a std::function.
2022-08-05 15:52:52 +02:00
The-EDev 25eefa1711 Addressed code reviews + small tweaks (unit test and paser.done()) 2022-07-22 17:17:38 +03:00
The-EDev b986d1e38a Find the route as soon as the URL is parsed 2022-07-22 17:17:38 +03:00
Vladislav Oleshko c6255750e6 Reuse cookie parser constructor 2022-07-10 14:45:40 +03:00
Vladislav 36e59f07ec
Merge branch 'master' into sessions 2022-07-04 12:54:15 +03:00
Vladislav Oleshko dbfc425916 Add locking test 2022-07-04 12:38:28 +03:00
Vladislav Oleshko f505c152e1 Remove custom keys 2022-07-04 12:27:25 +03:00
Vladislav Oleshko cbdb127b98 Small naming fixes 2022-07-04 10:50:14 +03:00
erik fcd38e7447 Fixed bug: Could not define route for HEAD method
Defining a HEAD method would give HTTP error code 405 (Method Not Allowed) and
calling OPTIONS on the route would return HEAD twice in the Allow header.
2022-06-30 08:07:11 +02:00
Vladislav Oleshko bd4f7cc847 Add small unittest 2022-06-25 17:16:42 +03:00
Luca Schlecker d3e19a53ab add initial unittests for utility::string_equals and utility::lexical_cast. 2022-06-18 17:21:37 +03:00
Luca Schlecker 2fbf93e211 replace std::error_code with asio::error_code.
This makes the code more consistent and also reflects the intention a little better.
2022-06-18 17:21:37 +03:00
Luca Schlecker 982e62eabf utility: add string trimming function. 2022-06-18 17:21:37 +03:00
Luca Schlecker 5b1c5a9e9e removing some boost includes, fixing version checks and further phase out boost. 2022-06-18 17:21:37 +03:00
Luca Schlecker df92d6d639 replace boost::lexical_cast with an equivalent based on std::stringstream. 2022-06-18 17:21:37 +03:00
Luca Schlecker f3d00bbecf replace boost::asio with standalone asio. 2022-06-18 17:21:37 +03:00
Luca Schlecker 78f764791e remove 'using namespace boost' declarations. 2022-06-18 17:21:37 +03:00
erik 3fe1ee062a Fixed base64 test to not depend on terminating null-characters in binary strings
std::strings with binary data should always be created with the constructor
taking a char pointer and the length of the character data.
2022-06-13 09:27:30 +02:00
erik f7758feab5 Make stream_response test independent of header size
The test was failing when built using my mingw64-11.2.0 toolset on the Windows
platform, on the 1.0+3 release.
2022-06-13 09:24:33 +02:00
Vladislav Oleshko 946292747e Small fixes 2022-05-23 20:17:49 +03:00
Vladislav 94fa9f77f6
Merge branch 'master' into app-constructor 2022-05-23 20:12:55 +03:00
Farook Al-Sammarraie a6bf90fa8b
Merge branch 'master' into blueprint-middleware 2022-05-23 09:43:17 +03:00
The-EDev f2b63f23f5
Fix for issue where app.stop() blocks when a websocket is open 2022-05-20 14:14:55 +03:00
Farook Al-Sammarraie 3e6c097733
Merge branch 'master' into #421-Websockets-should-support-a-maximum-payload 2022-05-18 20:04:38 +03:00
The-EDev 564b070d5f Made test port static and replaced `REQUIRE` with `CHECK` and `if`
Using port 0 seems to cause the test to be blocked
Also added methods and status codes to Crow's documentation
2022-05-18 15:57:46 +03:00
konrad 7e4f57486c Add extra log when status code is not defined.
Just to document behaviour when returning status that is
not well-known.
2022-05-18 15:57:46 +03:00
Farook Al-Sammarraie e7007cfbce
Merge branch 'master' into blueprint-middleware 2022-05-18 13:30:13 +03:00
The-EDev 94a0c3555a
formatting 2022-05-16 19:32:33 +03:00
The-EDev 0f6bfb04ee
added documentation and unit test 2022-05-16 19:15:34 +03:00
The-EDev c7001f81fc Removed test print 2022-05-14 12:05:06 +03:00