Commit Graph

681 Commits

Author SHA1 Message Date
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
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
Farook Al-Sammarraie
27439944b0
Merge branch 'master' into fix-stack-data-disclosure 2022-08-23 00:22:17 +03:00
Igor Mróz
d17a88af69
Fix stack data disclosure when returning static files smaller than
16KiB. It could also cause to return partially incorrect file ending in
case of file not being rounded up to 16KiB.

Thanks to Gynvael Coldwind and hebi for discovering and preparing
report.
2022-08-22 20:15:03 +02:00
The-EDev
0aa3ab94be
fixed unit-tests and warnings 2022-08-22 00:38:03 +03:00
The-EDev
fba01dc76d
Prevent HTTP pipelining which Crow doesn't support. 2022-08-21 21:33:04 +03:00
erik
b12767133a Don't use std::filesystem when compiling in C++17 mode on gcc < 8
On gcc < 8, filesystem had to be included as <experimental/filesystem>, it
was also living in the std::experimental namespace, and also required the user
to link against -lstdc++fs.
2022-08-06 00:59:57 +03:00
erik
99c4569408 Fix compilation error using std::filesystem::path
A std::filesystem::path is not implicitly convertible to a std::string.
2022-08-06 00:59:57 +03:00
Farook Al-Sammarraie
4e4dbec120 formatting 2022-07-25 13:56:54 +03:00