Commit Graph

689 Commits

Author SHA1 Message Date
ssams
96e049666e add HTTP status 406 2024-04-19 17:05:48 +02:00
ItsAlbertZhang
ad337a8a86 fix: compilation error with libc++ 2024-03-19 16:59:39 +01: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
db059ce4c4 adds flag to avoid adding blueprints multiple times 2024-03-10 13:11:56 +01:00
StefanoPetrilli
55e604f939 adds a flag to avoid adding static routes multiple times 2024-03-10 13:11:56 +01:00
StefanoPetrilli
a62956b61a split the different responsibilities of validate into different functions 2024-03-10 13:11:56 +01:00
bruvey
c47540bb8c Update http_connection.h 2024-03-02 10:19:00 +01:00
bruvey
d3bd942223 Update http_connection.h 2024-03-02 10:19:00 +01:00
June Han
5ecd04ade2 fix: call after_handlers for legitimate requests without body part 2024-02-21 21:37:51 +01:00
Corentin Schreiber
df756fed45
Use const std::string& as argument to route() (#684) 2024-01-29 18:10:20 +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
bruvey
4555ffd0c9
Fix #754 (#755)
* Update http_response.h
2024-01-26 19:38:05 +01:00
bruvey
78d1d2bfba fix #626 2024-01-09 20:16:31 +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
na-trium-144
921ce6f972 fix order of destructor call of io_service 2024-01-01 22:51:05 +01:00
jfm
f3e0846ee5 My mistake. Crow is compiled with c++11 under windows and has a macro for std::min not being defined as std::min(a,b) under c++11, CROW_MIN 2024-01-01 22:40:37 +01:00
jfm
6704b9b3ab Add <algorithm> header-file, it doesn't compile on windows if not included 2024-01-01 22:40:37 +01:00
jfm
195cd6ad00 Fixed a typo. As in other places, use 2^14 here 2024-01-01 22:40:37 +01:00
Felix
ae8643a1b6 Performance fix for non-static streaming data 2024-01-01 22:40:37 +01:00
Corentin Schreiber
42fab729a2 Add missing const to mustache and json::wvalue::operator[] 2023-07-08 13:04:48 +01:00
Gulliver
bb58cc1a8b removed superfluous move of temporary. 2023-06-14 08:46:40 +02:00
Gulliver
43ab82ea27 unused variables removed 2023-06-14 08:46:40 +02:00
Gulliver
f0ff5b63d8 query_string.h fixes 2023-06-14 08:46:40 +02:00
Gulliver
976df9586a utility.h fixes 2023-06-14 08:46:40 +02:00
Farook Al-Sammarraie
1d683b1e9a
Merge pull request #633 from anagno/fix-memory-leak
Fix memory leaks caused from the http_connection
2023-05-22 21:23:49 +03:00
Vasileios Anagnostopoulos
d5e0523602 Fix memory leaks caused from the http_connection
This memory leak was caused from the fact that we were creating a raw
pointers in the do_accept method of the http_server. The initial
connection was never released, but all subsequent connection
were released without problem. So this commit introduces shared_ptr
to manage all the connection and release the memory when the
connection is not needed any more.

Signed-off-by: Vasileios Anagnostopoulos <anagnwstopoulos@hotmail.com>
2023-05-14 13:38:42 +02:00
Marc Robert
4eb78bb366
Fixed compilation under android ndk, operator = was undefined 2023-05-12 00:49:57 +02:00
Stefano Petrilli
3b81e16614
Validate if the CROW_ROUTE starts with a '/' (#559) (#597) 2023-05-05 16:00:18 +02:00
Gabriel Schlozer
215834f8f9
Added a static method which create an empty json value crow::json::wvalue (outputs "{}" instead of a "null" string) (#602) 2023-03-30 14:09:36 +02:00
Ildar Kashaev
eef1abe415
Fix loghandler memleak (#609) 2023-03-30 14:03:02 +02:00
XandrOSS
bd86c26c6b
Get server running port, bindaddr and threads
- Added methods to get usefull information about running server instance: 
std::uint16_t port() -> Get the port that Crow will handle requests on
std::string bindaddr() -> Get the address that Crow will handle requests on
std::uint16_t concurrency() -> Get the number of threads that server is using
2023-02-08 10:33:48 -05:00
queenstdev
b493cd646e fix #587 Render true and false Mustache tags 2023-02-03 21:34:38 +01:00
S. V. Paulauskas
52a3caa09c CrowCpp/Crow#585 : Resolves issue with blueprint assignments.
Adds static_dir_, templates_dir_, blueprints_, and mw_indices_ to the assignment.
This ensures that the Blueprint is assigned all the information.
2023-02-01 08:41:12 -05:00
Gulliver
a77d7bd84f fix warning on non MS systems for using sprintf instead of snprintf 2022-12-25 18:24:51 +01:00
Andrea Cocito
c8e376cfa5
Apply workaround for Apple to FreeBSD aswell
Maybe these should be triggered by __clang__?
2022-12-12 21:06:42 +01:00
Farook Al-Sammarraie
c1c707371c
Merge branch 'master' into feature/fix-websocket-route-macro 2022-12-10 13:35:12 +03:00
Aleksi Sohlman
39a3472374 fix optimizeNode to prevent a crash on MSVC 2022-11-30 17:44:26 +02:00
Boleyn Su
73c543a007 Fix use-after-move 2022-11-30 09:18:21 +01:00
Simon Oehrl
cec165e29a Adapt CROW_WEBSOCKET_ROUTE to accept app reference 2022-11-23 13:37:34 +01:00
okaestne
5e19641d61 fix friend declarations 2022-11-08 10:32:37 +01:00
okaestne
9e7015281e http_response: don't try to move temporary 2022-11-08 10:32:37 +01:00
okaestne
2970f81001 app: remove unused lambda caption 2022-11-08 10:32:37 +01:00
okaestne
5543276c4e
http_connection: initialize task_id_ 2022-11-05 23:08:54 +01:00
okaestne
323a7cb48f
routing: use object references instead of raw pointers
this fixes some memory leaks.
also remove unused `get_size` method.
2022-11-05 23:08:49 +01:00
Seungwoo Kang
ac757ff0c9
Fix websocket crash from connection pointer dangling (#530)
* websocket: Add dangling-prevent anchor pointer

* websocket: Fix deadlock from incorrect expiration expectation

* webscoket: Fix unsafe write access to anchor_

* websocket: Fix build error from use of 'nullptr_t'

* websocket: Remove latent dereferencing on dangling 'this' pointer

* websocket: Resolve conflict with master branch

Co-authored-by: Vladislav <vladislav.oleshko@gmail.com>
2022-10-09 19:03:52 +03:00
Ryan Russell
f5adec7803
refactor(websocket): readability improvements (#541)
Signed-off-by: Ryan Russell <git@ryanrussell.org>
Co-authored-by: Vladislav <vladislav.oleshko@gmail.com>
2022-09-19 00:34:43 +03:00
Seungwoo Kang
1e47bc67ba
websocket: Reduce number of re-allocation of string parameters (#535)
Co-authored-by: Vladislav <vladislav.oleshko@gmail.com>
2022-09-18 23:57:37 +03:00
Ryan Russell
33becfb353
docs(middlewares): readability improvements (#540)
Signed-off-by: Ryan Russell <git@ryanrussell.org>
2022-09-18 23:24:29 +03:00