Commit Graph

44 Commits

Author SHA1 Message Date
Martin Chang
0b9d114746
Fix Failing to Build on MSYS2 (#952) 2021-07-27 10:53:04 +08:00
putao520
64f9f8b87f
Fix a md5 sum bug without openssl (#951) 2021-07-25 23:16:13 +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
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
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
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
interfector18
49181a22b2
Use canonical cmakelogic for cross compilation, (#768)
Fix clang c++20 build
2021-03-25 04:27:52 +08:00
Martin Chang
8bd1f5684e
Fix drogon::Task<> not destructing internal object (#729) 2021-03-01 13:36:03 +08:00
Martin Chang
a2142dd93e
Coroutine support (#693)
* app().registerHttpHandler() accepts coroutine as handlers
* HttpController can use coroutine as handlers'
* Http request handlers with coroutine catches exception instead of crashing the entire app
* DbClient now has execSqlCoro that is awaitable
* DbClient now has newTransactionCoro that is awaitable
* HttpClient have awaitable sendRequestCoro
* WebSocketClient have awaitable connectToServerCoro
* WebSocketClient have setAsyncMessageHandler and setAsyncConnectionClosedHandler
* drogon::AsyncTask and drogon::Task<T> as our corutine types
* Related tests
* Misc

Future work
* Coroutine for WebSocket server
* Known issues

co_future() and sync_wait may crash. It looks like GCC bug but I'm not sure.
Workarround: Make an coroutine of AsyncTask. Then launch said coroutine.
Not sure why wrapping the exact same thing in function crashes things.

Co-authored-by: an-tao <antao2002@gmail.com>
2021-02-06 17:05:58 +08:00
An Tao
0fe3f6fd8f
Use explicit lambda capture lists (#590) 2020-10-02 11:45:07 +08:00
An Tao
4c9463eeb7
Modify session handling (#568)
* Change thread unsafe interfaces to safe.

* Fix some compiler warnings
2020-09-15 08:28:04 +08:00
An Tao
ecb3d3f74f
Make app().run() method callable on a non-main thread (#457) 2020-06-06 12:24:06 +08:00
An Tao
58702dc41e
Port drogon to Windows (#335)
Co-authored-by: mcirsta <mforce2@gmail.com>
2020-01-25 11:58:20 +08:00
An Tao
a67ab1db52
Add some unit tests (#311) 2019-12-09 22:16:09 +08:00
An Tao
40ffb2d2af
Modify some code styles (#298) 2019-11-21 11:27:47 +08:00
Daniel Mensinger
795079531a cmake: use export namespace for Drogon::Drogon (#255)
* cmake: use ${PROJECT_NAME} instead of drogon everywere

* cmake: use export namespace instead of dummy library
2019-09-26 19:33:58 +08:00
An Tao
aa26e9a903
Modify the CMakeLists to modern cmake style (#229) 2019-08-31 08:27:57 +08:00
An Tao
c3cb70f415
Optimize performance (#222) 2019-08-24 13:12:04 +08:00
antao
40087fba9c Remove config.h
Modify the CMakeLists.txt

Remove the USE_ORM macro

Update trantor

Remove some std::dynamic_pointer_cast calls
2019-07-29 14:53:41 +08:00
antao
e714ae875e Use a temporary file instead of memory to store a large Http body recieved by drogon 2019-06-06 14:59:49 +08:00
antao
3452a2fa1c Modify some code to get a good style 2019-05-23 18:57:45 +08:00
antao
fc7505122f Update the submodule trantor 2019-05-23 16:07:08 +08:00
antao
e5fe92c67a Change the line length limit to 80 characters 2019-05-18 11:11:45 +08:00
antao
be08aba9d1 Add .clang-format 2019-05-17 22:49:09 +08:00
antao
e48692939c Modify some interfaces 2019-04-29 14:47:23 +08:00
antao
65c101bee0 Add the getLoop() method to the HttpAppFramework class 2019-03-26 10:45:39 +08:00
antao
db72840fc2 Move utility functions to the utils namespace 2019-03-21 17:47:45 +08:00
an-tao
0e447a1f9e Adapt ipv6 2019-03-13 23:44:53 +08:00
antao
bdcb42ce55 Merge branch 'master' of https://github.com/an-tao/drogon 2019-02-02 13:31:10 +08:00
antao
e77b558a71 Modify urlDecode() method 2019-02-02 13:26:19 +08:00
an-tao
287a7b5208 Add a header including in linux 2019-02-02 12:09:14 +08:00
antao
7041783579 Modify code style 2019-02-02 11:34:00 +08:00
an-tao
cbbee440ea Compatible with older versions of gcc 2019-01-29 22:24:32 +08:00
antao
615924c889 Debug form post request 2019-01-23 11:32:55 +08:00
antao
856aedbf47 Support gzip on the client side 2019-01-21 13:37:53 +08:00
antao
c4591fc11d Remove an unused file 2019-01-20 12:11:39 +08:00
antao
5c9799c15a Modify http client for cookies 2019-01-02 16:13:36 +08:00
antao
fb5bbde277 Modify something to improve performance 2018-12-24 15:06:05 +08:00
antao
20f97a78a2 Modify tests path 2018-11-27 18:29:23 +08:00