Commit Graph

1336 Commits

Author SHA1 Message Date
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 26dca0a910
Fix a connection bug of mariadb clients (#438) 2020-05-17 21:08:12 +08:00
An Tao cddd17eb55
Fix some compilation warnings (#432) 2020-05-16 10:11:50 +08:00
antao 84eb05ce38 Update trantor 2020-05-10 18:41:42 +08:00
Rafał Bugajewski 398b028046
Pass Data From View to Its Layout Container (#429) 2020-05-09 14:13:20 +08:00
Rafał Bugajewski 91e7ead628
Merge pull request #427 from an-tao/drogon_ctl
Fix a bug in drogon_ctl that would skip lines longer than 8092 characters.
2020-05-08 13:35:23 +02:00
antao 8ecfe9ef84 Fix a bug in drogon_ctl 2020-05-07 18:57:03 +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
antao 6d6a7acd09 Bump version to 1.0.0-beta16 2020-04-27 21:49:06 +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
interfector18 17b8c337f9
Standardize Row and Result api (#409)
* Standardize Row and Result api, throw specific exceptions

* Fix drogon_ctl for sqlite3 models

* Add mysql and sqlite3 tests, add exception throwing tests

* configure mysql in travis-ci

Co-authored-by: antao <antao2002@gmail.com>
2020-04-11 11:46:47 +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 2fb0f845f6
Update trantor (#405) 2020-04-03 10:20:58 +08:00
antao 3a2c472694 Update drogon version to v1.0.0-beta15 2020-03-28 16:11:14 +08:00
An Tao d7cb5b715a
Exit the listen loop first when closing (#404) 2020-03-27 20:54:57 +08:00
An Tao c46c7f3570
Fix DrogonConfig.cmake for Windows (#403) 2020-03-24 22:08:12 +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
An Tao f5e87acd9b
Remove dependency on pkg-config (#398)
Considering that on FreeBSD, pkg-config has been replaced by pkgconfig, we should remove the dependency on pkg-config.
2020-03-21 12:41:15 +08:00
ihmc3jn09hk 98ab826cfc
Fix drogon_ctl runtime error when compiling drogon to shared library (#397)
Fix for #395
2020-03-21 08:40:25 +08:00
An Tao 06bf158676
Fix issues in the MysqlConnection class (#394) 2020-03-20 23:12:05 +08:00
antao 8551106d8f Modify Dockerfile 2020-03-18 20:08:08 +08:00
An Tao 7af67dc4da
Make CMake install files relocatable (#387) 2020-03-18 19:54:48 +08:00
interfector18 4c8dbdbb85
Ninja (#391)
Use ninja to build if found on system (in /bin/ninja)
Make make simulate ninja's default parallelism

Should help with travis_ci as default build environments have 2 cores.
2020-03-17 00:54:30 +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
An Tao dd8fbe04cd
Addressed an issue when loading layout views dynamically (#378) 2020-03-12 10:26:07 +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 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
ihmc3jn09hk 686e30b250
Fix bug for PR #369 (#370)
Missing ">" for model.csp template
2020-03-01 18:07:21 +08:00
An Tao 8d17cc567e
Fix the 'many to many' relationship (#369) 2020-03-01 16:48:18 +08:00
An Tao 810896c94c
Fix warnings on Windows (#368) 2020-03-01 11:50:47 +08:00
ihmc3jn09hk 4bd19773b5
Update for ORM time mapper (#367)
The timelocal() function is equivalent to the POSIX standard function mktime(3). There is no reason to ever use it.
https://linux.die.net/man/3/timelocal
2020-03-01 02:33:01 +08:00
An Tao e171874524
Modify installation on Windows (#366) 2020-02-29 15:46:08 +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