Commit Graph

293 Commits

Author SHA1 Message Date
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 ce704aff5b
Update trantor (#656)
* Update trantor
* Make some minor modifications.
2020-12-14 08:49:33 +08:00
An Tao 566297d4df
Create cmake.yml (#653) 2020-12-13 18:12:30 +08:00
An Tao 28f6338271
Remove the use of std::filesystem to adapt to old compilers (#652) 2020-12-12 20:37:44 +08:00
an-tao 35b4a86e06 Bump version to 1.2.0 2020-12-12 16:33:13 +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
An Tao 4f9ee82153
Modify the WebSocketTest controller to create a simple chat room (#625) 2020-11-14 11:48:40 +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 0fe3f6fd8f
Use explicit lambda capture lists (#590) 2020-10-02 11:45:07 +08:00
Elwin.Zhu 3222c0df84
Modify the FileUpload.csp in simple_example to avoid CORS (#573) 2020-09-15 16:20:56 +08:00
An Tao e032f9bd0e
Add getListeners() method to the HttpAppFramework class (#559) 2020-09-07 00:51:07 +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 8f6269b208
Add a method to disable unicode escaping in json string (#491) 2020-06-24 08:11:32 +08:00
An Tao a9f4bff519
Properly handle chunked encoding requests. (#479) 2020-06-16 20:36:31 +08:00
itgenie98 2607f35687
Fix CORS for new HTTP PATCH method (#477)
* Fix CORS for new HTTP PATCH method, also fix HttpRequestImpl::appendToBuffer, to be able to send PATCH requests

* Fix simple_example_test to work with updated CORS
2020-06-15 10:05:05 +08:00
itgenie98 14b5ec08ee
Add HTTP PATCH method (#476) 2020-06-14 21:57:25 +08:00
An Tao e7b7618c37
Use string_view to parse multipart/form-data requests (#469) 2020-06-10 11:11:24 +08:00
adrian fd2a612945
add digest filter in examples (#462)
* add digest filter in examples

* Add getMd5() function to the public API

Co-authored-by: Adrián Ortiz Gutiérrez <aortiz@MacBook-Pro.local>
Co-authored-by: antao <antao2002@gmail.com>
2020-06-07 14:43:05 +08:00
An Tao c43ba9e514
Add support for brotli compression (#406) 2020-04-04 18:15:15 +08:00
An Tao 45d2969dcb
Graceful shutdown (#393)
Call app().quit() to gracefully stop a drogon application.
2020-03-21 21:29:33 +08:00
ihmc3jn09hk 2401c6a88a
Fix null jsonObject from newHttpJsonRequest (#388)
* Fix null jsonObject from newHttpJsonRequest 

Refer to #372 for the response case as well
2020-03-15 00:11:46 +08:00
An Tao 9ee00da431
Fix crash with partial matched url (#386) 2020-03-14 11:36:21 +08:00
An Tao ebb8b7b70a
Add ENABLE_EXPORTS property in cmake configuration files (#375) 2020-03-05 22:03:41 +08:00
An Tao 56817978e6
Fix a bug on filters with WebSocketControllers (#374) 2020-03-03 15:58:26 +08:00
An Tao 49d1697bec
Fix a bug when creating json responses (#373) 2020-03-02 23:34:28 +08:00
An Tao e171874524
Modify installation on Windows (#366) 2020-02-29 15:46:08 +08:00
An Tao 71b60823da
Modify dynamic view loading algorithm (#339) 2020-02-16 17:19:16 +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
antao fb2343ac74 Add location configuration for static resources (#331) 2020-01-12 11:05:38 +08:00
An Tao 62fc82cba1
Add support for regular expressions when routing (#329) 2020-01-09 17:03:30 +08:00
An Tao feb0b73e78
Modify the benchmark example (#321) 2019-12-23 14:08:56 +08:00
An Tao 4809cc9508
Modify the reverse proxy example (#319) 2019-12-16 00:34:40 +08:00
An Tao ea43d8127d
Add a reverse proxy example (#309) 2019-12-08 08:31:56 +08:00
An Tao 93c0d7e9da
Reset the flag used to parse json to false before recycling HttpRequest objects (#304) 2019-11-28 23:33:50 +08:00
An Tao 40ffb2d2af
Modify some code styles (#298) 2019-11-21 11:27:47 +08:00
An Tao e7b6ba27bb
Make user can use a custom type parameter instead of the first parameter in handlers of HttpControllers (#284) 2019-10-19 14:27:34 +08:00
An Tao 3a3a5636e8
Add type conversion methods to the HttpRequest and HttpResponse classes (#283) 2019-10-18 22:26:20 +08:00
An Tao 228bac1cfb
Make user can use any string as a placeholder's name in routing patterns (#282) 2019-10-17 17:12:52 +08:00
An Tao d830c4f057
Fix some race conditions (#280)
* Fix a race condition of static files

* Fix a race condition of 404 pages
2019-10-17 09:23:14 +08:00
Daniel Mensinger 656bd2462b Do not use smart pointers in thread storage (#269) 2019-10-03 19:22:37 +08:00
An Tao 323bf0693a
Use the IOThreadStorage for responses caching and fast database clients storage (#267) 2019-10-03 10:17:54 +08:00
Armstrong 1414704b44 add per request attribute store (#259) 2019-09-28 21:48:06 +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
Armstrong ae01eb5ded fix url decode (#256)
* urldecode: should always unescaped chars
2019-09-26 10:06:09 +08:00
An Tao 9855fc9b4f
Fix bugs in HTTP view examples (#246) 2019-09-16 10:10:23 +08:00
An Tao aa26e9a903
Modify the CMakeLists to modern cmake style (#229) 2019-08-31 08:27:57 +08:00
An Tao 7186a74590
Add a WebSocket test (#227) 2019-08-26 17:53:02 +08:00
An Tao 9f330f310d
Add a synchronous join point for AOP (#226) 2019-08-26 09:00:20 +08:00
An Tao c3cb70f415
Optimize performance (#222) 2019-08-24 13:12:04 +08:00
An Tao a0f5570f8b
Modify HttpClient and WebSocketClient (#210) 2019-08-13 17:32:52 +08:00
An Tao c705990fe5
Add the DrogonConfig.cmake (#207)
Add DrogonConfig.cmake so that users can use drogon with the `find_package(Drogon)` command.
2019-08-08 15:17:09 +08:00
An Tao ba7d788184
Add options for 'Server' header and 'Date' header (#202) 2019-07-31 19:44:32 +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
An Tao 986ef8dda7
Optimize pipelining (#197)
* Optimize pipelining

* Optimize the DbClientLockFree class
2019-07-25 16:30:42 +08:00
An Tao 33577b9666
Format some files for good code style (#196) 2019-07-16 20:00:20 +08:00
An Tao 9af87bb1c0
Add some managers to reduce the size of the HttpAppFrameworkImpl code (#194) 2019-07-12 16:47:21 +08:00
An Tao 6e8c718a52
Modify some comments in simple_example (#193) 2019-07-11 19:39:23 +08:00
antao b155aa1b1a Add a README file for examples 2019-07-10 17:57:47 +08:00
antao 47c6bc20f4 Optimize the htmlTranslate method 2019-07-08 13:49:01 +08:00
antao 9f779f2636 Update CacheFile class to adapt linux 2019-06-06 16:51:12 +08:00
antao 335f852aab Add some necessary headers in preflight responses for CORS 2019-06-01 07:11:47 +08:00
antao 92e64a79ec Fix a bug that occurs when a path argument contains spaces 2019-05-31 09:43:23 +08:00
antao fc7505122f Update the submodule trantor 2019-05-23 16:07:08 +08:00
antao c17591ef49 Make some inline functions out-line 2019-05-23 10:47:15 +08:00
antao a4c0e33782 Make the HttpClient class support cookies 2019-05-21 22:10:05 +08:00
antao 11b6d20a69 clang-format 2019-05-18 20:39:57 +08:00
antao 3e1886a84e Add the forward() method to the framework 2019-05-09 16:27:39 +08:00
antao e696553b3d Change the callback type in Filters and AOP Advices to the r-reference type 2019-05-09 13:57:33 +08:00
antao 00049c0d23 Change the type of the callback in HTTP request handlers to r-reference type 2019-05-09 11:25:25 +08:00
antao 2efa183b93 Implement gzip_static 2019-05-03 14:44:20 +08:00
antao fa9376b89a Change escapes from '{{}}' to '[[]]' in views 2019-04-25 14:36:42 +08:00
antao 189c537c29 Support host strings with IPv6 address in the HttpClient class 2019-04-24 16:48:03 +08:00
antao 32c14631fa Add the getHandlersInfo() method 2019-04-24 14:38:07 +08:00
antao 1bc07c5197 Add support for AOP 2019-04-18 18:37:31 +08:00
antao e517f07685 Add some methods using std::chrono_literals 2019-04-14 14:02:37 +08:00
antao d5e8bd0b73 Add the OPTIONS method for CORS 2019-04-12 21:45:43 +08:00
antao e87c9a75f6 Modify the implementation of WebSocket 2019-04-08 16:37:24 +08:00
antao 3a587ab90b Modify the pipeling test 2019-04-07 12:15:02 +08:00
antao b96eb04859 Add WebSocket client support 2019-04-07 00:46:22 +08:00
antao 40dc13f0bd Add ws_test.html for websocket testing 2019-04-05 09:54:26 +08:00
antao 62fad73bc9 Enhance HttpClient to support pipelining 2019-04-05 01:50:29 +08:00
an-tao e128a27c58 Modifying URL encoding of HTTP requests 2019-04-03 00:17:30 +08:00
antao d216a663aa Modify the HttpController template to be able to specify absolute paths in HttpController 2019-03-31 19:32:16 +08:00
antao 737c9bba8b Provides a way for users to create and initialize controllers and filters with non-default constructors. 2019-03-30 23:09:22 +08:00
antao aad06fdc3a Add support for plugins 2019-03-29 15:34:14 +08:00
antao 8ae07ce195 Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR in CMakeLists.txt files 2019-03-27 19:32:09 +08:00
antao 1f8be1ce8c Add some Travis CI tests 2019-03-26 15:25:22 +08:00
an-tao 798861a1cc Use IPV4 in the webapp example 2019-03-25 23:28:22 +08:00
antao 66456eae1a 1. Add the getCustomCOnfig() method.
2. Add some comments.
2019-03-25 17:44:22 +08:00
antao 56eaca1998 Update README.md and the banner image 2019-03-24 23:17:12 +08:00
antao db72840fc2 Move utility functions to the utils namespace 2019-03-21 17:47:45 +08:00
antao fecec81975 1.Remove an unnecessary null pointer check
2.Fix a compilation error for older g++
    3.Update README.md
2019-03-20 11:46:27 +08:00
antao 7ae533671c Add matchedPathPattern() interface in the HttpRequest class
Change version to 0.9.31
2019-03-18 10:44:38 +08:00
antao 053c760d27 Rename the InnerIpFilter class 2019-03-14 11:25:12 +08:00
an-tao 0e447a1f9e Adapt ipv6 2019-03-13 23:44:53 +08:00
antao 250781ac08 Add configuration options that limit the number of keep-alive requests 2019-03-12 18:22:13 +08:00