Commit Graph

71 Commits

Author SHA1 Message Date
okaestne
9e7015281e http_response: don't try to move temporary 2022-11-08 10:32:37 +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
Alexander Goussas
1bdcd317b7 add response constructor overload 2022-07-05 17:14:50 -05:00
Michael Schreckenbauer
83cde80023 added comment on S_ISREG 2022-06-22 15:00:00 +02:00
MichaelSB
5f73f39ea7
Simplified condition for defining S_ISREG
Co-authored-by: Farook Al-Sammarraie <farook@the-e-dev.com>
2022-06-22 14:54:52 +02:00
Michael Schreckenbauer
df3d7cad41 define S_ISREG on windows 2022-06-22 10:54:25 +02:00
Michael Schreckenbauer
c593fbb3b4 only allow regular files in set_static_file_info, return 404 in all other cases 2022-06-15 09:20:11 +02:00
Vladislav
4d4d0094fe
Merge branch 'master' into blueprint-middleware 2022-05-07 23:03:35 +03:00
Dan Keenan
869a0abb04 Fix header name. 2022-04-21 19:51:22 -04:00
Dan Keenan
885ac41d99 Formatting fixes. 2022-04-20 16:26:09 -04:00
Dan Keenan
89226687ea Avoid exception handling. 2022-04-20 16:18:50 -04:00
Dan Keenan
33df7fc35b Handle extensions without mime types assigned to them. 2022-04-16 17:35:44 -04:00
Vladislav Oleshko
3b9e522523 Blueprint middleware prototype 2022-04-11 16:01:27 +03:00
Farook Al-Sammarraie
9db0e3b8fe
Merge branch 'master' into parser_optimization 2022-02-15 15:56:48 +03:00
Farook Al-Sammarraie
1c98bbb860
Merge branch 'master' into local-middleware 2022-02-14 22:17:19 +03:00
Dominique Jacquel
787506350f Add unsafe/unsanitized load functions 2022-02-11 09:48:33 +00:00
Farook Al-Sammarraie
ab50fb3134
Merge branch 'master' into parser_optimization 2022-02-11 00:46:19 +03:00
The-EDev
9f6e099f10
fixed issue where content length was being set but body wasn't being sent 2022-02-09 20:57:12 +03:00
Vladislav Oleshko
80bc1cf00a Fix clang format 2022-02-08 20:18:49 +03:00
The-EDev
175b004c26
code formatting (also disabled formatting where not applicable) 2022-02-06 22:29:46 +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
Vladislav Oleshko
5d6db06706 Add local middleware after handlers to request handler 2022-02-02 17:37:19 +03:00
The-EDev
e688cbd18e
Fixed another vulnerability in mustache file loading
and made the file sanitizer a copy-less function
2022-01-11 21:48:51 +03:00
The-EDev
0a16021442
Fix vulnrabilities in mustache and static 2022-01-11 20:27:41 +03:00
Farook Al-Sammarraie
faa81ec4a5
Merge branch 'master' into auth_tutorial 2021-12-04 04:17:09 +03:00
The-EDev
94a2f942bc
changed comment style back to the original (doxygen did not work with the new style) 2021-12-03 06:39:23 +03:00
The-EDev
3c6c675a18
formatting 2021-12-02 20:38:04 +03:00
The-EDev
a0a5616d1c
Added missing buffer clears and removed no longer used method from response 2021-12-02 20:18:34 +03:00
The-EDev
bb48f95298
moved file sending to connection and added check_destroy to it 2021-12-02 15:36:52 +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
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
5823a5984e remove the need for #define CROW_MAIN.
This is achieved using the conts type qualifier as it gives internal linkage.
fixes #273

Signed-off-by: Luca Schlecker <luca.schlecker@hotmail.com>
2021-11-21 17:25:16 +01:00
hg333
9546058604 added another constructor with status-code 2021-08-29 16:36:13 +05:30
hg333
b0e84a8c80 added custom type support 2021-08-29 12:19:18 +05:30
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
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
b837877715 updated head and no_length variable names 2021-04-03 13:48:36 +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
The-EDev
6f5514743a added automatic HEAD method handling 2021-03-13 13:51:27 +03:00
rittelle
3b151d569d Properly clear responses
Closes #104.
2021-02-12 13:21:59 +01:00
The-EDev
747ad6db72 Merge branch 'master' 2021-01-21 21:37:55 +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
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
09d0f4ccdd Added HTTP compression using gzip or deflate (disabled by default, requires calling method) 2021-01-02 22:12:04 +03:00