Commit Graph

645 Commits

Author SHA1 Message Date
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
An Tao 5bb54cd4cf
Fix a bug in compressing by zlib (#308) 2019-12-07 01:26:12 +08:00
An Tao 5c1c73d9b6
Add the SecureSSLRedirector plugin (#306) 2019-11-30 08:35:40 +08:00
An Tao 2784a91dcb
Handle gzip errors safely (#305) 2019-11-29 00:28:12 +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
Philip Woods 0fa61cded3 path is now explicitly set to '/' when setting JSESSIONID (#301) 2019-11-28 09:15:27 +08:00
An Tao 40ffb2d2af
Modify some code styles (#298) 2019-11-21 11:27:47 +08:00
An Tao d46a041cba
Modify the Cookie class (#296) 2019-11-15 10:26:21 +08:00
antao 944d1e786d Delete useless log output 2019-11-05 14:28:17 +08:00
Marwan Rabbâa fc8abadaeb fix(compilation on alpine): Replace non standard u_short alias (#292) 2019-11-03 23:32:37 +08:00
An Tao a71e37d86e
Modify some type names to meet the Google Style (#291) 2019-11-01 19:19:25 +08:00
An Tao dbf20200fc
Add the headers configuration option for static files (#290) 2019-10-31 15:47:12 +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 ddc41f7907 Add option to disable setting the 404 status code (#277) 2019-10-11 21:54:01 +08:00
An Tao 8f5c757ce2
Modify the quit() method (#276) 2019-10-11 17:24:28 +08:00
An Tao df82728a45
Add interfaces for accessing content of attachments. (#274) 2019-10-08 15:46:48 +08:00
An Tao e8a6bdc245
Fix some race conditions (#270) 2019-10-04 14:17:48 +08:00
Daniel Mensinger 656bd2462b Do not use smart pointers in thread storage (#269) 2019-10-03 19:22:37 +08:00
An Tao d6e5c1959c
Modify some code of responses cache (#268) 2019-10-03 17:50:55 +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
Daniel Mensinger daf72d3059 Ensure AutoInit can only be used with std::shared_ptr (#266) 2019-10-03 01:47:51 +08:00
Daniel Mensinger ffb8a9d0e4 Thread storage (#265) 2019-10-02 22:29:25 +08:00
An Tao f9d7f589a2
Add the getCurrentThreadIndex() method (#264) 2019-10-01 20:33:25 +08:00
An Tao 5605d7d351
Fix a error in setThreadNum method (#263) 2019-10-01 01:40:22 +08:00
An Tao 56b9a320b5
Fix a error in HttpClient (#262) 2019-10-01 00:58:30 +08:00
An Tao 70eda27427
Add the ability to create restful API controllers (#244)
* Add the ability to create restful API controllers

* Update the model.json template file

* Modify the 'create controller' command of the drogon_ctl

* access column values by column array indexes instead of column names when constructing an instance of a model class

* Fix a bug of mysql database

* Add some static SQL into models

* Add validations to models

* Add setToNull method to models

* Support 'where in' substatement

* Delay rendering from json to the response body. This allows users to modify the json object before sending a response.

* Add synchronous method to the HttpClient class
2019-09-30 21:34:30 +08:00
An Tao 2cdc060ed7
Add a setCustomContentTypeString() method to the HttpRequest class (#261) 2019-09-30 09:27:34 +08:00
Armstrong 1414704b44 add per request attribute store (#259) 2019-09-28 21:48:06 +08:00
An Tao eed9c06250
Fix some compilation warnings (#257) 2019-09-27 16:05:38 +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 569f1677ce
Fix bug with parsing json (#253) 2019-09-23 18:14:58 +08:00
antao 543d1a8c80 Fix a bug when HTTP method is PUT 2019-09-16 13:01:40 +08:00
An Tao 9855fc9b4f
Fix bugs in HTTP view examples (#246) 2019-09-16 10:10:23 +08:00
An Tao fff40952a3
Modify the method to generate the 404 page (#240) 2019-09-11 15:14:40 +08:00
An Tao aaaba8aa97
Fix a bug of models (#239) 2019-09-10 15:14:57 +08:00
An Tao 5d3fda57a0
Remove ClassTraits.h (#235) 2019-09-07 21:00:51 +08:00
An Tao 195bc5299e
Add comments for doxygen (#233) 2019-09-06 23:10:36 +08:00
An Tao 473b1c86f0
Fix a bug in the HttpServer class (#232) 2019-09-03 15:03:12 +08:00
An Tao eb894396c7
Use find('x') instead of find(x) in a string search (#230) 2019-09-01 12:06:19 +08:00
An Tao aa26e9a903
Modify the CMakeLists to modern cmake style (#229) 2019-08-31 08:27:57 +08:00
An Tao a0b68fb3c9
Optimize request headers processing (#228) 2019-08-27 13:55:52 +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 ba49a0e0e6
Update README (#225)
* Update README

* Update CMakeLists.txt
2019-08-24 22:44:37 +08:00
An Tao 043c484a64
Make the framework API support chained calls (#223) 2019-08-24 14:44:25 +08:00
An Tao c3cb70f415
Optimize performance (#222) 2019-08-24 13:12:04 +08:00