Commit Graph

666 Commits

Author SHA1 Message Date
Martin Chang 98da3490e7
return awaiter from coroutine instead of resumable (#733) 2021-03-05 22:21:02 +08:00
Martin Chang 8bd1f5684e
Fix drogon::Task<> not destructing internal object (#729) 2021-03-01 13:36:03 +08:00
JuergenGleiss af2bd6ba69
HttpRequest: add feature to avoid url encoding of path (#730) 2021-02-28 23:42:15 +08:00
Martin Chang cde19a1f57
Valivate certificate in HttpClient (#726)
Co-authored-by: an-tao <antao2002@gmail.com>
2021-02-22 11:45:33 +08:00
An Tao 0f5721119c
Support SNI in the HttpClient class (#724) 2021-02-21 16:05:58 +08:00
An Tao eb2d24197a
Fix the error when SSL handshake fails (#717) 2021-02-15 09:15:26 +08:00
interfector18 12cfdd5916
Lowercase all http headers, add webp and avif types (#718) 2021-02-15 09:14:54 +08:00
An Tao 3b8b63d17d
Add drogon::orm::CoroMapper<T> template (#712)
Co-authored-by: marty1885 <marty188586@gmail.com>
2021-02-13 18:22:17 +08:00
interfector18 6542236b20
Add default value interface to sqlbinder for mysql and postgresql (#704) 2021-02-07 10:34:49 +08:00
An Tao 4c577e6fa9
Fix compilation errors on vs2019 (#706)
Fix compilation errors on VS2019 when coroutines are enabled
2021-02-06 19:53:30 +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 7ce5768372
Return 404 or 405 responses correctly (#705) 2021-02-06 15:16:44 +08:00
An Tao 5426100bde
Fix a error in the HttpClient class when a response has no content-length header (#698) 2021-02-03 14:54:45 +08:00
Jiannan Liu 4b5885e3c0
Serve wasm files with the correct MIME type (#667) 2020-12-26 12:21:43 +08:00
An Tao ec59dbbc3d
Add option for setting float precision in Json string (#666) 2020-12-24 20:00:29 +08:00
An Tao ce704aff5b
Update trantor (#656)
* Update trantor
* Make some minor modifications.
2020-12-14 08:49:33 +08:00
ivanka2012 1abd8b3506
Add implicit page resolving capability (a-directory -> a-directory/index.html) (#647)
Co-authored-by: an-tao <antao2002@gmail.com>
2020-12-11 14:02:47 +08:00
An Tao 8b7ffb28d7
Add support in the SqlBinder class and the Session class (#644) 2020-12-06 11:41:06 +08:00
An Tao 7dd2d6123b
Add the reuse_port option (#634) 2020-11-25 19:47:36 +08:00
Martin Chang 4ca90f2415
Don't send content type in a 304 response (#630) 2020-11-18 22:31:55 +08:00
An Tao 4ce2d25d55
Return 400 if the content-length is invalid (#629) 2020-11-18 15:09:25 +08:00
Joakim L. Gilje 886dfc3648
Support OpenBSD (#626)
Co-authored-by: an-tao <antao2002@gmail.com>
2020-11-15 12:18:01 +08:00
An Tao 4f9ee82153
Modify the WebSocketTest controller to create a simple chat room (#625) 2020-11-14 11:48:40 +08:00
An Tao 7e8beacd1d
Fix error when receiving response without content-length header (#623) 2020-11-11 21:50:43 +08:00
An Tao dbf21f7dbc
Fix a bug when creating sqlite3 database models (#618) 2020-10-27 21:26:01 +08:00
An Tao de37a0ae29
Add the Host and Sec-WebSocket-Version headers when connecting to a websocket server (#615) 2020-10-25 08:36:40 +08:00
An Tao 43e7b3fec0
Add --path-to-namespace option to drogon_ctl for creating views (#607) 2020-10-12 21:51:39 +08:00
An Tao 34d2fe45c3
Modify the procedure of the app().run() method (#603) 2020-10-09 15:02:05 +08:00
VayuDev de0d793fc7
Fix HttpServer::isWebSocket to detect lowercase "upgrade" connection value (#594)
* Fix HttpServer::isWebSocket to detect lowercase "upgrade" connection value

The websocket library boost-beast sends the following http header:
'Connection: upgrade', while almost anything else uses:
'Connection: Upgrade'. Drogon used to only recognize the latter as
websocket request, now it recognizes both.

* Fix HttpServer::isWebSocket to detect case-insenstive "websocket"
upgrade value

This was a bug as previously, we only accepted the exact string
"websocket", although the standard specifies that it should be
case-insensetive.

Co-authored-by: VayuDev <vayudev@protonmail.com>
2020-10-04 22:53:33 +08:00
An Tao 0fe3f6fd8f
Use explicit lambda capture lists (#590) 2020-10-02 11:45:07 +08:00
An Tao 465d2ebfe8
Disable TLS1.0/1.1 on HTTPS by default (#588) 2020-10-01 23:40:46 +08:00
L0ric0 6fca7067da
Add ConfigLoader::ConfigLoader(const Json::Value &data) (#579) 2020-09-18 21:12:46 +08:00
an-tao c320527f9d Delete a confusing log output 2020-09-17 23:12:33 +08:00
Martin Chang c4ff98e620
remove execution permission on /tmp/drogon.lock (#575) 2020-09-16 00:59:19 +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
Jiannan Liu 6f7a062221
Suppress sanitizer warning (#572)
Add default initializer for HttpConstraint::method_ member variable to avoid the following warning given by gcc's undefined behavior sanitizer (-fsanitize=undefined):

drogon/lib/inc/drogon/utils/HttpConstraint.h:30:7: runtime error: load of value 32767, which is not a valid value for type 'HttpMethod'
2020-09-14 15:11:53 +08:00
An Tao a32170b9a3
Modify the documentation of the method fileData() (#566) 2020-09-12 13:59:04 +08:00
An Tao 11cabfb546
Remove the useless method stat() from the PluginBase class (#563) 2020-09-10 08:45:23 +08:00
An Tao e032f9bd0e
Add getListeners() method to the HttpAppFramework class (#559) 2020-09-07 00:51:07 +08:00
Martin Chang 3a00ffde47
Add support for status code 418 (#557) 2020-09-03 21:11:25 +08:00
An Tao a10e6bfb1c
Modify methods related to headers (#552) 2020-08-26 20:28:19 +08:00
An Tao 7117d96016
Fix an issue of simple_reverse_proxy when handling chunked transfer-e… (#549)
* Fix an issue of simple_reverse_proxy when handling chunked transfer-encoding
2020-08-25 08:07:43 +08:00
An Tao f1a7462c4c
Modify the Result class in orm (#541) 2020-08-16 20:00:14 +08:00
An Tao c4d727cbe6
Fix compilation warning of sprintf function (#537) 2020-08-14 08:10:56 +08:00
An Tao 3a10db99c7
Set the response Access-Control-Allow-Headers header correctly for OPTIONS requests (#534) 2020-08-13 21:41:29 +08:00
An Tao 960309e615
Resolve an issue when sending big files (>=2gB) on Windows (#529) 2020-08-09 19:20:51 +08:00
An Tao fda2719dd4
Fix the session bug introduced in PR #523 (#528) 2020-08-06 19:35:30 +08:00
An Tao 43a21ddc9c
Provide users with a method to change the session ID of a session (#523) 2020-08-03 19:18:47 +08:00
An Tao 820715cd62
Set session to requests for websockets (#521) 2020-07-31 09:25:20 +08:00
An Tao 34cefefce4
Modify parseContentType function (#518) 2020-07-25 10:01:06 +08:00