Commit Graph

738 Commits

Author SHA1 Message Date
Martin Chang 56cb305ae3
Support custom MIME types and extensions (#1024)
* Drogon now support custom extension and MIME types
* Added contentTypeString() to retrieve the string version of content type (in case the content type is not in the ContentType enum)
* setCustomContentTypeAndString() also accepts MIME as input (instead of the full content-type header string),
* Remove webContentTypeToString()
* Added app().registerCustomExtensionMime()
* Added support to load custom extension from JSON config
2021-09-24 22:51:09 +08:00
Martin Chang c7b6c8403f
allow outside access to the file path of a HTTP response (#1020) 2021-09-17 13:14:23 +08:00
An Tao 94c7add7a1
Fix a bug in the getIOLoop method (#1014) 2021-09-07 21:42:08 +08:00
NitroMelon ba5187868d
Improve AccessLogger. (#1008) 2021-09-02 08:20:49 +08:00
Martin Chang 6b0e38fc8f
Experimental HaikuOS Support (#1002) 2021-08-28 11:47:24 +08:00
NitroMelon b2bf247048
Support sending files by range (#1001) 2021-08-26 23:33:58 +08:00
An Tao d60f962aa3
Add stop() method to the WebSocketClient class (#972)
* Fix memory leak in the WebSocketClient class

Co-authored-by: marty1885 <marty188586@gmail.com>
2021-08-15 18:17:05 +08:00
Martin Chang 477c3dca7d
Fix test success message incorrectly shown when -s is flag present (#962) 2021-08-07 23:07:48 +08:00
Martin Chang 88236f9279
Add port() and host() to HttpClient (#959) 2021-08-05 23:10:05 +08:00
Martin Chang 0b9d114746
Fix Failing to Build on MSYS2 (#952) 2021-07-27 10:53:04 +08:00
An Tao da87c124ae
Use HAS_STD_FILESYSTEM_PATH in filesystem.h (#950) 2021-07-25 23:17:32 +08:00
putao520 64f9f8b87f
Fix a md5 sum bug without openssl (#951) 2021-07-25 23:16:13 +08:00
Martin Chang 25cba9a2a5
Add missing include (#942) 2021-07-21 00:18:31 +08:00
An Tao 991873cf60
Correctly check the case-insensitive value of the upgrade header of responses in websocket connections (#935) 2021-07-16 17:03:00 +08:00
Greisberger Christophe 5c1c81e828
Feature/support windows unicode paths (#928) 2021-07-15 23:57:12 +08:00
Greisberger Christophe d888816997
Added support for paths containing unicode characters on Windows (#921)
Co-authored-by: Christophe Greisberger <christophe@greisberger.fr>
Co-authored-by: an-tao <antao2002@gmail.com>
Co-authored-by: marty1885 <marty188586@gmail.com>
2021-07-12 22:38:02 +08:00
PColis c5398b26cb
Update CacheFile.cc (#916)
On Windows, ftell returns a 32 bits signed integer.
On Windows we had to use _ftelli64 to return a signed 64 bits integer.
2021-07-02 19:08:28 +08:00
Martin Chang 0efd0c34c1
Generic optimizations (#913) 2021-06-30 23:37:59 +08:00
James Armes 5245f136b7
Add GCC-compatible warnings to the example executables (#910) 2021-06-27 09:54:02 +08:00
Martin Chang 04c7c7eb22
Fix WS client example not working with integration_test_server and print error when WS encounters bad IP address (#902) 2021-06-24 23:29:50 +08:00
Martin Chang b8d820fc2a
Fix single layer directory traversal in StaticFileRouter (#901)
The StaticFileRouter can access file in the immediate parent directory if the
client sends a specially crafted, non RFC conforming HTTP 1.x request. By
sending a HTTP request without a "/" predicating the path. The StaticFileRouter
fails to detect directory traversal since it checks for "/../" in the path.

This PR fixes the issue by detecting if there's potential for directory
traversal. If true, we follow the path and detect if it reaches out of the
document root at any point. Also added 2 new tests for edge cases in static
file serving. (Not related to the bug).

Co-authored-by: an-tao <antao2002@gmail.com>
Bug discovered by: oToToT <https://github.com/oToToT>
2021-06-24 13:04:19 +08:00
Martin Chang 834e3eabdd
Fix CacheMap crash in CI tests (#890)
It is possible for the CacheMap to destruct while timeout callback is
active. This causes a very rare data race. And it's my hypothesis that
this is the reason behind CacheMap crashes on CI. This patch locks the
weels upon cestructing.
2021-06-13 10:33:30 +08:00
Philip Kovacs a70a2844b1
Fix compiler warnings (#886)
Co-authored-by: an-tao <antao2002@gmail.com>
Co-authored-by: Martin Chang <marty1885@users.noreply.github.com>
2021-06-09 19:14:15 +08:00
An Tao e7ec973095
Create controller instances after running instead of after being called (#888) 2021-06-09 10:58:56 +08:00
An Tao 945b26dc0c
Fix routing mismatch (#885) 2021-06-07 21:35:22 +08:00
Martin Chang 4abbf76214
Optimize HttpControllersRouter for cases where regex is not needed (#883) 2021-06-07 11:57:45 +08:00
An Tao 6a3f72f2e5
Fix 'build.sh -tshared' (#882) 2021-06-04 18:45:21 +08:00
an-tao b654e35e51 Add the setCustomStatusCode method 2021-06-01 19:30:21 +08:00
Tommy Chiang e1cbd1b987
Add SSL_CONF_cmd support (#871) 2021-05-29 16:53:46 +08:00
Martin Chang ffc410a66e
Improve WebSocket mask handling (#875) 2021-05-29 15:11:41 +08:00
An Tao 1bddbb117a
Dos2unix (#874) 2021-05-28 09:52:34 +08:00
Martin Chang 0b5075bfa9
Drogon test framework (#869) 2021-05-27 20:09:57 +08:00
An Tao 1e87c35b8f
Fix a bug of string_view for MSVC (#870) 2021-05-25 16:51:49 +08:00
An Tao 8052c38f49
Make Json::Value as a SQL parameters type (#861) 2021-05-22 13:08:17 +08:00
An Tao 3601992546
Move resolverPtr when distorying an HttpClietImpl object (#860) 2021-05-20 13:15:59 +08:00
Martin Chang 32970172f6
Make AsyncTask only destruct when the coroutine reaches end of execution (#857) 2021-05-18 19:20:15 +08:00
An Tao 9a059aedef
Add the AccessLogger plugin (#854) 2021-05-17 21:45:18 +08:00
Martin Chang 706fc70abc
Fix sync_wait/co_future use-after-free (#855)
* Fix sync_wait and co_future heap use-after-free
* Fix sync_wait deadlock if on a single thread
* Fix WebSocketCoroTest crash
2021-05-17 19:41:16 +08:00
An Tao cd093fc97e
Add the PreSendingAdvice to AOP (#853) 2021-05-16 19:38:16 +08:00
Martin Chang f736e12a05
Fix double free in coroutine exception handling (#851) 2021-05-15 14:10:14 +08:00
An Tao 74b3ca3db6
Set running flag to true before installing plugins (#849) 2021-05-12 23:50:29 +08:00
陈晓林 e478b63dda
Add support 'select <db>' for redis (#847)
Co-authored-by: an-tao <antao2002@gmail.com>
2021-05-12 18:32:49 +08:00
Martin Chang 0e70be0a95
Fix coroutine frame leak upon assigning to awaitable (#848) 2021-05-12 16:05:20 +08:00
Philip Kovacs 2c53cf086a
Add missing mutex include (#845) 2021-05-11 09:24:14 +08:00
Martin Chang 6bfbf97eea
Print error before terminating in AsyncTask (#841) 2021-05-06 17:50:11 +08:00
Tommy Chiang cb1876f26b
Remove duplicated inclusion (#838)
This remove the duplicated `#include "HttpClientImpl.h"` in `lib/src/HttpAppFrameworkImpl.cc`.
2021-05-04 22:36:59 +08:00
An Tao 74d57ab7fa
Add the validateCert parameter to the newWebSocketClient method (#835) 2021-05-02 20:15:27 +08:00
An Tao 51814b76da
Add the setTimeout() method to the ReidsClient class (#830) 2021-04-30 08:00:11 +08:00
An Tao 685aaaa3da
Add the setTimeout() method to the DbClient class (#823) 2021-04-29 10:13:34 +08:00
An Tao a33bf2bf34
Send the content-length header even if the body(POST,PUT,OPTIONS,PATCH) is empty (#825) 2021-04-28 18:04:57 +08:00