Commit Graph

694 Commits

Author SHA1 Message Date
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
An Tao
5bd85170bf
Fix a bug when saving uploaded files on Windows (#514) 2020-07-17 13:18:52 +08:00
An Tao
c8640700ea
Add the getJsonError method (#507)
* Add the getJsonError method to the HttpRequest and the HttpResponse classes
2020-07-09 19:50:30 +08:00
An Tao
9d3efeac67
Optimize the HttpResponse class (#505) 2020-07-06 08:39:20 +08:00
An Tao
f871d1607d
Modify static files router and 404 pages generator (#497)
1.Except for the GET method, it is forbidden to use any other method for accessing static files.
2.Use following sequence to create 404 pages.
 * try to use user customized 404 handler;
 * try to use user customized error handler;
 * use default handler to create 404 pages;
2020-07-02 09:59:17 +08:00
An Tao
306c072af7
Add a timeout parameter when sending HTTP requests (#493) 2020-06-27 09:45:14 +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
ccd51d289e
Destroy DNS resolver of HttpClient in the correct thread (#490) 2020-06-22 19:55:24 +08:00
An Tao
3424d3f2c4
Add a way to set the character set when creating DbClient objects (#486) 2020-06-20 20:21:14 +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
2457f9b413
Add a method for the TERM signal handling (#475) 2020-06-14 17:36:10 +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
ihmc3jn09hk
bbef8780fd
Fix a bug in ListenerManager::getIOLoop() (#461)
Co-authored-by: antao <antao2002@gmail.com>
2020-06-06 12:59:54 +08:00
An Tao
e015439740
Add a new joinpoint of AOP for modification on each HTTP response (#460) 2020-06-06 12:25:21 +08:00
An Tao
ecb3d3f74f
Make app().run() method callable on a non-main thread (#457) 2020-06-06 12:24:06 +08:00
VayuDev
d4d5adf88b
Added additional formats for getHttpDate function and fixed undefined behavior upon error (#453) (#456)
This patch adds support for the RFC 850 and asctime format. If an error
occurs, we now return a date with the epoch value of -1 and warn instead of
triggering undefined behavior. This is checked by a new set of tests.

Co-authored-by: VayuDev <vayudev@protonmail.com>
Co-authored-by: antao <antao2002@gmail.com>
2020-06-05 20:57:36 +08:00
An Tao
5faab6b414
Modify the WebSocketConnection class (#452)
* Add getContextRef method to the WebSocketConnection class

* Expose some functions on Windows

* Send a close message when closing a web socket connection
2020-06-04 19:11:07 +08:00
antao
49472a3cc4 Create a class template for publish subscribe pattern (#443) 2020-05-24 20:42:00 +08:00
antao
84e503a948 Bump version to 1.0.0-beta17 2020-05-23 10:47:24 +08:00
Vedran Miletić
375498a5a6
Fixes for FreeBSD (#440)
* Use uuid(3) to generate UUIDs on FreeBSD

FreeBSD is now handled like Windows so additional UUID libraries are
not required.

* Modify build.sh script to work on FreeBSD

- /bin/bash -> /usr/bin/env bash
- nproc -> sysctl -n hw.ncpu
2020-05-20 22:29:37 +08:00
Zach Hilman
c754d65cf0
Add additional HttpStatusCodes and implement a custom error handler (#439)
This adds:

Various lesser-used HTTP status codes to the HttpStatusCode enumeration.
Getter and setter for customErrorHandler, which is a function that generates a HttpResponsePtr given an HttpStatusCode. This is intended to be similar to the custom404 functionality, allowing a user to override the layout of the error page.
The custom404 functions were kept even though this supersedes that to avoid breaking current code.

Finally, all of the Routers were updated to use the error handler for their 405/403 responses.

If no custom error handler is set, a default is used. The default behavior is identical to what exists now, an empty body with the status code set.
2020-05-19 11:50:44 +08:00
An Tao
4423d836f4
Add methods to get DbClient connection status (#436) 2020-05-18 08:31:18 +08:00
An Tao
cddd17eb55
Fix some compilation warnings (#432) 2020-05-16 10:11:50 +08:00
An Tao
490def6742
Add filters on static file locations (#422) 2020-05-03 08:21:34 +08:00
interfector18
eafdc5d357
Add causal profiling with coz (#414) 2020-04-30 13:30:37 +08:00
ihmc3jn09hk
a7f49d893e
Support url safe base64 codec (#417)
Co-authored-by: antao <antao2002@gmail.com>
2020-04-26 23:23:03 +08:00
An Tao
4f8290b589
Remove non standard macros (#415) 2020-04-25 02:12:44 +08:00
ihmc3jn09hk
269acbc477
Use splitString in trantor (#413)
Co-authored-by: antao <antao2002@gmail.com>
2020-04-18 11:13:53 +08:00
An Tao
7d6be171c5
Parse content-type (#408) 2020-04-07 23:30:59 +08:00
An Tao
c43ba9e514
Add support for brotli compression (#406) 2020-04-04 18:15:15 +08:00
An Tao
d7cb5b715a
Exit the listen loop first when closing (#404) 2020-03-27 20:54:57 +08:00
An Tao
1969effd29
Return a 404 page when requesting a directory as a static file (#401) 2020-03-24 09:26:41 +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
interfector18
d0dfa242b2
Add getHomePage to HttpAppFramework (#390)
Add getHomePage to HttpAppFramework to help with SPA in scenarios a controller must take a certain action on passed parameters but redirect to homepage
2020-03-17 00:53:31 +08:00
An Tao
6c850ea886
Modify the Attributes interface of the HttpRequest class (#389) 2020-03-15 16:11:40 +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
2d87434bfb
Use a separate thread to load views dynamically (#382) 2020-03-12 14:35:46 +08:00
Rafał Bugajewski
3c7ac585a6
Dynamic View Loading: Only Compile Modified “csp” Layouts (#380)
This change greatly reduces the time between multiple Drogon runs
while developing an application with the framework. Previously on a
relaunch the framework naively compiled all *.csp files if dynamic
view loading was turned on. Now there will be a check for modification
time and the compilation phase will only run if the
corresponding *.csp file is newer than the dynamic library.

Co-authored-by: Rafał Bugajewski <rb@cocobit.software>
2020-03-12 09:44:51 +08:00
An Tao
bb8b5ded79
Fix a fatal bug in the MysqlConnection class (#379) 2020-03-11 12:41:20 +08:00
An Tao
77063e28d0
Optimize the rendering of HTTP responses (#371) 2020-03-07 20:49:05 +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
810896c94c
Fix warnings on Windows (#368) 2020-03-01 11:50:47 +08:00
Wang Gao
d5cd882248
Add support for MSVC 2015 (#365)
Co-authored-by: An Tao <antao2002@gmail.com>
2020-02-26 12:36:46 +08:00
bor8
53f61e9b66
Update HttpAppFrameworkImpl.cc (#363) 2020-02-24 10:05:13 +08:00
An Tao
2fb1e1ecb1
Minor modification (#362) 2020-02-23 23:27:40 +08:00
ihmc3jn09hk
eb316d8263
Update Content-Type support for PDF (#361) 2020-02-23 18:31:27 +08:00
An Tao
ee77800821
Implement br_static (#359) 2020-02-23 17:39:03 +08:00
An Tao
71b60823da
Modify dynamic view loading algorithm (#339) 2020-02-16 17:19:16 +08:00
ihmc3jn09hk
3c15f65a7f
Add IOLoop access function. (#353)
Co-authored-by: An Tao <antao2002@gmail.com>
2020-02-16 16:48:35 +08:00
An Tao
3d8c304a47
Remove get_version.sh (#344) 2020-02-06 22:13:50 +08:00
An Tao
dd5e8f8159
Support 'password' keyword in configuration files (#343)
* Support 'password' keyword in configuration files

* Update travis-ci
2020-02-04 10:58:10 +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
4f319dd9c9
Fix an issue of out-of-range (#334) 2020-01-21 00:49:53 +08:00
antao
191acd0bd3 Modify the StaticFileRouter 2020-01-12 11:39:53 +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
cb95960e2d
Modify singleton logic of DrClassMap (#325) 2020-01-03 18:02:46 +08:00
antao
249a491d2f Modify the text template 2020-01-03 12:47:08 +08:00
An Tao
bc7ec6975a
Modify the SqlBinder class (#324) 2020-01-03 10:29:06 +08:00
An Tao
53e9dcca08
Optimize database connections (#323) 2020-01-02 17:09:10 +08:00
An Tao
1c99a8a94e
Use drogon::OStringStream instead of std::stringstream in text template (#322) 2020-01-01 16:15:11 +08:00
An Tao
feb0b73e78
Modify the benchmark example (#321) 2019-12-23 14:08:56 +08:00
An Tao
27c687a0af
Support HTTP1.0 clients (#320) 2019-12-22 13:15:56 +08:00
An Tao
4809cc9508
Modify the reverse proxy example (#319) 2019-12-16 00:34:40 +08:00
An Tao
20c43b3c2d
Merge pull request #313 from an-tao/ossp_uuid 2019-12-10 07:01:25 +08:00
An Tao
a67ab1db52
Add some unit tests (#311) 2019-12-09 22:16:09 +08:00
antao
f1b5f2797c Update 2019-12-09 17:28:25 +08:00
antao
0a990f4331 Make a patch to support the ossp UUID Library 2019-12-09 17:22:38 +08:00