Commit Graph

325 Commits

Author SHA1 Message Date
The-EDev
8f9486e3c8 added initial chunk sending code (for SSL only) 2020-10-11 00:29:40 +03:00
The-EDev
7ba3c9161f fixed type mismatch issue when using SSL 2020-10-09 16:01:24 +03:00
The-EDev
744baf8c0a Refactored mime type generating script
using with instead of open and close
removed while loop
using one line to write the new file
using unordered map instead of ordered map
added indentation to the generated file
2020-10-07 12:17:37 +03:00
Farook
24c04c65cf updated generated file comment 2020-10-04 19:17:58 +03:00
Farook
7e812ea58a removed content-type related comments 2020-10-04 19:14:13 +03:00
Farook
dd79b31274 added automatic Content-Type header based on file extension 2020-10-04 19:11:18 +03:00
Farook
3f38caa0d0 stole @digitalist's sendFile code and made it work with newer boost 2020-10-04 15:05:26 +03:00
Igor Mroz
b6003f5c6a
Merge pull request #2 from nowgoing/master
Update websocket.h function "void do_read()"
2020-08-24 21:00:05 +02:00
SQyang
0cb9330125
Update websocket.h 2020-08-24 19:47:30 +08:00
SQyang
215b7dcf35
Update websocket.h 2020-08-13 13:18:16 +08:00
Igor Mroz
1a92344dd4
Merge pull request #1 from moneroexamples/fix_boost_170
fixes problem with boot 1.70
2019-11-05 18:59:00 +01:00
moneroexamples
c95f68499e fixes problem with boot 1.70 2019-07-01 14:49:10 +08:00
Igor Mróz
741ba25abf Merge branch '#146_add_ip_address_field' 2018-09-28 21:24:06 +02:00
Igor Mróz
ef7fa91631 #146 Added field with remote IP address. 2018-09-28 21:16:36 +02:00
Igor Mróz
809453f9d5 #315 Checking if server is nullptr. 2018-08-30 17:51:54 +02:00
Jaeseung Ha
49edf898a5
Merge pull request #274 from mwm126/mingw-gmtime_s
Use gmtime_s on MinGW
2017-12-27 23:33:31 +09:00
ipknHama
d1a30bf422 Avoid exceptions while closing sockets 2017-12-25 22:36:30 +09:00
ipknHama
05d02fea6e Remove printf warning for lld, llu 2017-12-25 16:26:30 +09:00
ipknHama
b7360a2bac Support multiple methods for same URL
- fix broken unittests because of server initializing order change
 - add a function to wait until server is up
2017-12-25 15:31:20 +09:00
ipknHama
daa1e3eadc Add PURGE method, add a special enum item for counting 2017-12-25 15:31:20 +09:00
Jaeseung Ha
6876a08e61
Merge pull request #260 from erikaldsund/fix_rvalue_copy_ctor_bug
Fixed bug in json::rvalue copy constructor
2017-12-25 15:31:11 +09:00
Jaeseung Ha
943dcba507
Merge pull request #259 from erikaldsund/fix_r_string_inconsistency
Fixed bug in r_string
2017-12-25 15:30:32 +09:00
Jaeseung Ha
01cc7a3508
Merge pull request #258 from erikaldsund/fix_handling_of_big_integers
Fix handling of big integers
2017-12-25 15:30:06 +09:00
Mark Meredith
6974d3fcf9 Use gmtime_s on MinGW 2017-12-24 12:38:52 -05:00
Jaeseung Ha
49bd1c2797
Merge pull request #261 from erikaldsund/fix_warning_in_websocket_h
Fixed warning in websocket.h: right shift count >= width of type
2017-12-25 02:29:25 +09:00
roxma
f0eb73ce8c Fix ws read failure when using 16bit payload
Also should use ntohs instead of htons when read from socket.
2017-12-22 17:53:51 +08:00
Erik Åldstedt Sund
3c45393b2d Don't call copy_l before all other members are set
This lead to undefined behaviour during copy.
2017-10-30 20:51:44 +01:00
Erik Åldstedt Sund
29824c84ed Fixed bug in r_string: end of string pointer was not updated in the force member function
This could lead to undefined behaviour in the std::string conversion
operator, when using the iterator interface (begin() / end()), and the size()
member function.
2017-10-30 20:50:17 +01:00
Erik Åldstedt Sund
ecbbd0ebf2 Fixed ostream operator for big integers 2017-10-30 20:47:48 +01:00
Erik Åldstedt Sund
4fe7dd171a Handle big integers in json::wvalue
Handled by adding an enum num_type in both rvalue and wvalue (to separate
between signed/unsigned ints, and floating point values) and a union for
the number value in wvalue.
2017-10-30 20:47:48 +01:00
Erik Åldstedt Sund
83bd8c09a0 Fixed warning in websocket.h: right shift count >= width of type
Fixed by static_cast-ing values from 32-bit values to 64-bit values.
2017-10-30 20:45:34 +01:00
Jaeseung Ha
7f3f72441c Merge pull request #253 from boodkb/patch_method
Add support for HTTP PATCH method
2017-10-21 20:51:35 +09:00
Simon Rasmussen
f88657a22a Added 413 and 429 status codes 2017-10-20 15:20:18 +02:00
BooD
8b01385465 Add HTTP PATCH support 2017-10-05 18:13:40 +03:00
ipknHama
7560f329c9 Remove unused include. 2017-09-18 04:43:51 +09:00
ipknHama
2c26b6c1de Change default settings
- disable crow debug mode by default
 - expose `loglevel` method on `App` to change the logging level easily
 - add a startup message that guides how to change the logging level
2017-09-18 02:58:53 +09:00
ipknHama
e93ba25f2c Fix cookie parsing: Cookie doesn't have escaping mechanism. 2017-09-18 02:39:46 +09:00
ipknHama
9c26e1ebde Simplify json.keys() 2017-09-18 01:21:18 +09:00
Jaeseung Ha
08acc7c0be Merge branch 'master' into master 2017-09-18 00:43:42 +09:00
Jaeseung Ha
d8c4a67176 Merge branch 'master' into master 2017-09-17 19:17:54 +09:00
Jaeseung Ha
4786dac0a8 Merge pull request #193 from vadz/show-concurrency
Show the number of threads used in the startup message
2017-09-17 18:31:24 +09:00
Jaeseung Ha
112e86b906 Merge pull request #194 from vadz/atomic-conn-count
Use atomic type for connection count shared between threads
2017-09-17 18:30:24 +09:00
Jaeseung Ha
c32aae4b5f Merge pull request #183 from philave/vs2015-compilation-fix
MS VS2015 compilation fix.
2017-09-17 18:29:52 +09:00
Jaeseung Ha
ef17b8cb9b Merge branch 'master' into master 2017-09-17 18:01:57 +09:00
ipknHama
c071f64376 Delete new connection with error while accepting (kwangsei, PR #205) 2017-09-17 14:13:33 +09:00
Jaeseung Ha
f0cb83df88 Merge pull request #210 from zxmarcos/master
Add onaccept handler to websocket rule
2017-09-17 14:17:46 +09:00
Jaeseung Ha
cf67a40e4c Merge pull request #212 from uctakeoff/fix_warning_in_cpp11
Fixed a problem that warning appeared in c ++ 11
2017-09-17 14:10:07 +09:00
ipknHama
92bea9e949 Change vector to unordered_map for get_dict 2017-09-17 14:02:46 +09:00
ipknHama
f35089b2aa Add missed header file. 2017-09-17 13:47:05 +09:00
Jaeseung Ha
13fdc9390b Merge pull request #202 from Rasie1/master
Conflict with std namespace
2017-09-17 13:50:50 +09:00
ipknHama
69a17f066b Fix #245. Trying to keep serving after an exception in the handler. 2017-09-17 12:45:13 +09:00
Jaeseung Ha
2564c62778 Merge pull request #229 from JaewooSeo/wvalue_vector
wvalue (json) support vector<wvalue>
2017-09-17 12:40:05 +09:00
Jamie Bullock
679fe4a8ac Add support for HTTP 422 status code
See: https://tools.ietf.org/html/rfc4918#section-11.2
2017-09-04 16:40:40 +01:00
Jamie Bullock
9a1e4aefdd Revert "Add support for HTTP 422 status code"
This reverts commit 6e4e66ad12.
2017-09-04 16:38:51 +01:00
Jamie Bullock
6e4e66ad12 Add support for HTTP 422 status code
See: https://tools.ietf.org/html/rfc4918#section-11.2
2017-09-04 16:08:02 +01:00
jaewoo.seo
777852c97d wvalue (json) support vector<wvalue> 2017-05-12 11:43:27 +09:00
Rasie1
01b21296bc Add get_dict method 2017-03-16 19:25:27 +03:00
ushiyake
bd2dd4a8e4 Fixed a problem that warning appeared in c ++ 11 2017-01-09 21:24:01 +09:00
Marcos Medeiros
bea1ba3797 Add onaccept handler to websocket rule 2016-12-28 11:06:56 -02:00
Vsevolod Kvachev
32d66d6fd1 Upgrade amalgamate 2016-12-06 18:22:10 +03:00
Sergiu Giurgiu
c63113f825 Removed strict-aliasing warning 2016-12-04 14:03:20 -05:00
Vadim Zeitlin
bd9a9ace4a Use atomic type for connection count shared between threads
Even if this variable is only used in debug mode, it's still bad to have data
races on it, as it was the case (and reported by thread sanitizer) before.
2016-11-15 16:44:45 +01:00
Vadim Zeitlin
34b050ee8f Show the number of threads used in the startup message
This can be useful, especially when using the default hardware concurrency, to
see how many threads does the server actually use in the logs.
2016-11-15 16:33:14 +01:00
Philip
366e7c7e4b MS VS2015 compilation fix. It’s better to use native Win32 (strncpy_s, sprintf_s) to avoid compilation errors when building by MS C++. 2016-10-21 18:22:24 +03:00
Taylor King
26c4d5ddef implement .keys() 2016-10-10 06:10:01 -04:00
yorickdewid
e40605da59 HTTP response redirect
- Log address
2016-10-03 15:32:16 +02:00
yorickdewid
f4f6b02403 Set cast type without dereferencing pointer 2016-10-03 13:47:22 +02:00
ipknHama
3081e4e1a8 Cleanup include folder into crow subfolder
- only crow.h is exposed now
2016-09-21 23:11:06 +09:00
ipknHama
7af78aff5a Fix bugs in websocket
- `Upgrade: websocket` should be case-insensitive
 - Using network byte order for length field
2016-09-15 17:29:08 +09:00
ipknHama
5ae0dffddf Add a field to websocket::connection for storing user data 2016-09-10 02:39:22 +09:00
ipknHama
d07a26f3f8 Closing behavior change; should help #151 2016-09-10 02:13:50 +09:00
ipknHama
7d428f4265 Remove meaningless debug log 2016-09-10 02:13:13 +09:00
ipknHama
031f850b94 Add inline to avoid unused function warning 2016-09-10 01:25:49 +09:00
ipknHama
a1a587784e Add missing dependency (for amalgamate) 2016-09-10 01:22:06 +09:00
ipknHama
8a4b126ea6 Add a function which loads plain text file from templates folder 2016-09-10 01:22:06 +09:00
ipknHama
079df6efc5 Add a periodic handler feature 2016-09-10 01:22:06 +09:00
Eugene Timokhov
0a9418b307 Fixed missing static keyword for non-template functions 2016-09-07 01:09:08 +03:00
Jaeseung Ha
43c9b09345 Add dependent header 2016-09-06 09:39:45 +09:00
Jaeseung Ha
800d31411d Fix issue #89 2016-09-06 09:39:13 +09:00
Eugene Timokhov
f3350597a3 Fixed crow::json::detail::r_string move operator 2016-09-04 03:33:49 +03:00
ipknHama
967adf0de5 Add websocket feature 2016-08-28 14:46:31 +09:00
ipknHama
f88b56dff0 Add u() for uint64_t: manually applying #129 2016-08-27 18:12:17 +09:00
ipknHama
e161da45e0 Remove warnings: manually applying #101, #104 2016-08-27 18:03:49 +09:00
ipknHama
9e851ec896 Handling macro issues
- fix IS_NUM conflict (for MySQL)
 - avoid DELETE, ERROR (for Windows)
2016-08-27 14:15:16 +09:00
rayburgemeestre
ee220daeef expose server stop() in Crow app to allow shutdown other than signal. 2016-06-19 12:50:40 +02:00
ipknHama
c164db353b fix warning (initializing order of bind_addr_) 2016-05-23 22:04:09 +09:00
Jaeseung Ha
cb5ef23ef0 Merge pull request #107 from kumagi/master
defeat some warnings
2016-05-23 21:52:37 +09:00
Jaeseung Ha
eb5a3b55f9 Merge pull request #126 from gmaisto/master
Added support to bind to a specific interface
2016-05-23 21:51:30 +09:00
Jaeseung Ha
f96f65938d Merge pull request #113 from pierobot/master
Added inline to get_type_str
2016-05-23 21:47:47 +09:00
Gino Maisto
1b1210685e Bind to interface support: fixed unittest 2016-03-19 16:05:48 +01:00
Gino Maisto
e5d73b4c53 Added support to bind to a specific interface 2016-03-14 19:43:45 +01:00
Jaeseung Ha
975205075d Merge pull request #123 from pierobot/fix-corrupt-buffers
Fix corrupt buffers
2016-03-14 19:46:21 +09:00
pierobot
7712b8b8e0 Fix misspell of Connection 2016-03-07 17:30:19 -06:00
pierobot
dbd7c2fbe0 tab to space 2016-03-07 17:22:35 -06:00
pierobot
f57d257dc6 Fix buffer corruption bug
https://github.com/ipkn/crow/issues/122
2016-03-07 17:21:19 -06:00
pierobot
34112749eb Added inline to get_type_str 2016-01-12 13:43:16 -06:00
kumagi
47673eaddc defeat some warnings 2015-12-24 20:42:21 +09:00
Samuel Marks
37085e09c4 [Feature] JSON body i() now works with strings. Added better error messages also. 2015-09-27 14:36:08 +10:00
Samuel Marks
55dd19eb81 [Feature] JSON response can now include status code 2015-09-27 13:33:09 +10:00
Jaeseung Ha
e4708671bc implement HTTPS support
- define CROW_ENABLE_SSL to use
 - close #88
2015-09-20 22:06:00 +09:00
Dmitry Ledentsov
070d099a1c Update crow.h 2015-07-26 20:59:44 +02:00
ipknHama
5b72a09973 fix multithread bug occurs while accepting new connection 2015-05-27 14:47:51 -04:00
ipkn
4f5e36f927 Merge pull request #60 from sivachandran/master
Fix for linker symbol redefinition errors when crow header is included in multiple source files
2015-05-09 23:32:42 +09:00
Bryce Anderson
243995f36f Fix memory error and invalid param when no params are present
Also added a unit test that fails with the previous behavior.
Note that `-fsanitize=address` exposes the invalid memory access in
qs_parse.
2015-04-30 20:56:28 -04:00
Siva Chandran
a0ffd76e9c Made all parameter_tag related functions into static inline instead of constexpr. 2015-04-25 12:07:24 +05:30
Siva Chandran
e99cec63a1 Made parameter_tag related functions to constexpr/static to avoid linker symbol redefinition error when crow header is included in multiple cpp files. 2015-04-25 11:54:22 +05:30
Gabriel Marinho
441a9f6e61 Revert "Suggestion: Change the server name variable to a constant on settings.h"
This reverts commit 100f4a7b73.
2015-04-13 18:51:32 -03:00
Gabriel Marinho
100f4a7b73 Suggestion: Change the server name variable to a constant on settings.h
With this constant is very more easy to change the Crow server name.
2015-04-13 18:43:24 -03:00
Gabriel Marinho
b7a7df0412 Fix Content-Type not setted passing JSON object by rvalue reference.
In this specific case, Crow is not setting the JSON Content-Type and this is causing "not well-formed" exception in the Firefox browser.
2015-04-13 01:23:45 -03:00
ipkn
028cd0ecc0 Merge pull request #53 from JaewooSeo/vs2013
VS2013 x64 build support
2015-03-18 22:39:41 +09:00
jaewoo.seo
f0f5b223f0 VS2013 x64 build support 2015-03-15 17:51:55 +09:00
Jonas Westerlund
13b8a70c51 Fix parameter typos 2015-03-12 14:53:45 -07:00
ipknHama
48811ce4a4 remove thread_local variables
* move thread_local variables forget_cached_date_str, timer_queue
   into each threads local stack
2015-02-20 13:44:46 +09:00
ipknHama
5507e98ce2 fix tab to space 2015-02-20 12:00:15 +09:00
ipknHama
3a5599e61a refactor DynamicRule and TaggedRule to support common pattern
* name, methods
2015-02-20 11:58:41 +09:00
ipknHama
0a7c997349 working on VS2013 support
* wrap constexpr
 * add run-time version of get_parameter_tag
2015-02-20 11:50:34 +09:00
ipknHama
02f81f7eaa add CROW_MSVC_WORKAROUND and CROW_CAN_USE_CPP14 macro 2015-02-20 11:47:23 +09:00
ipknHama
92cf40e053 change gmtime to the safer version 2015-02-20 11:07:23 +09:00
ipknHama
f1d1fd6480 change 0b literals to 0x for VS2013 support 2015-02-20 10:54:32 +09:00
ipknHama
7fe8e2cfdc change SFINAE mechanics to support VS2013 2015-02-20 10:53:43 +09:00
ipknHama
5d8d527639 add run-time check for handler type for route_dynamic 2015-02-19 12:16:28 +09:00
ipknHama
d564d486b5 added route_dynamic 2015-02-19 00:57:01 +09:00
Jaeseung Ha
07042b55fd fix #27 : handling routes with trailing slash 2015-01-19 19:03:06 +09:00
Jaeseung Ha
b5942c4dda add member initialization:
need_to_call_after_handlers_
2015-01-19 18:59:55 +09:00
Jaeseung Ha
e27de5edac add const to request::get_header_value method 2015-01-19 18:58:19 +09:00
ipknHama
3fc1424e62 fix issue #39, bug at assigning vector to json wvalue 2015-01-08 08:22:06 +09:00
ipknHama
f6fdf68fe2 Merge branch 'try-catch-handle' of https://github.com/acron0/crow into acron0-try-catch-handle
Conflicts:
	amalgamate/crow_all.h
2014-12-12 07:29:08 +09:00
ipknHama
966867a9ca change pointer to reference; fix up spaces 2014-12-12 01:38:57 +09:00
Antony Woods
c2f75a7de1 Merged upstream 2014-12-10 17:29:31 +00:00
Antony Woods
a1751967c3 Added a general purpose try-catch around handle() for instances where an exception would cause the server to never return a response. At some later date we would possibly still wish to provide a custom hook for dealing with 500s. Also note, after an exception is caught, the generated 500 response is still sent to middleware handlers 2014-12-10 17:24:13 +00:00
ipkn
21b027774e Merge pull request #38 from acron0/json-bool
Added boolean types to json rvalue (.b()) including test
2014-11-12 09:23:21 +09:00
ipknHama
f52778f04d Fixes a bug that crow::json failed to parse double value starting with 0 2014-11-09 08:52:23 +09:00
Jaeseung Ha
49cad23ac9 Fixes #32 by chaing types for operator overloading from int32_t to int, long 2014-11-09 08:20:04 +09:00
Jaeseung Ha
11128435cd fix query_string bug that crashed test 2014-11-09 08:20:04 +09:00
Antony Woods
5120b127b0 Merged changes from master 2014-11-06 14:16:07 +00:00
Antony Woods
6d24711208 Added boolean types to json rvalue (.b()) including tests 2014-11-06 14:10:38 +00:00
Antony Woods
738d5d47b5 Responses constructed from json::wvalue now automatically set the appropriate Content-Type header 2014-11-04 17:12:52 +00:00
Antony Woods
693aac108d Post-pull commit 2014-10-24 09:40:09 +01:00
ipknHama
4b3b8070e7 added missing header for amalgate 2014-10-24 04:17:20 +09:00
ipknHama
bdc9dd8d48 added missing header for amalgate 2014-10-24 02:45:34 +09:00
Antony Woods
27bf11d35c Re-implemented 'get_middleware()' as suggested, without changing the Server constructor and now no longer encountering hangs 2014-10-23 18:33:03 +01:00
ipknHama
5c5c8fb4f5 improve code quality
add missing includes (for amalgation)
remove register keyword (remove clang warning)
change define names to avoid name collision
remove url size limit from query_string.h
change MAX_KV_PAIRS define to const variable
add & to arguments
readability improve (although it requires additional allocation)
2014-10-24 01:18:29 +09:00
Antony Woods
ada3039707 Fixed compiler errors and inlines some of the qs_parse functions 2014-10-22 09:40:33 +01:00
Antony Woods
3a2d22dfe0 Removed instance of 'using namespace std' 2014-10-22 09:34:30 +01:00
Antony Woods
6a2def410c Fixed merge oddities 2014-10-14 18:25:22 +01:00
Antony Woods
06842721d7 Wrapped qs_parse as query_string and added tests 2014-10-14 09:48:35 +01:00
ipknHama
a5fab23f70 HTTP GET/POST method distinguish 2014-10-07 21:51:24 +09:00
Antony Woods
6890436742 Fixed sign comparisson warning 2014-09-23 21:02:26 +01:00
Antony Woods
54fb4fa3d4 Merge branch 'master' of github.com:acron0/crow into url-params-in-req 2014-09-23 20:42:32 +01:00
Antony Woods
3b4bf01a7d URL params are now present as a ci_map variable of request 2014-09-22 21:34:22 +01:00
ipkn
bad75f25b8 fix bug in keep-alive header handling 2014-09-19 19:20:35 -04:00
ipknHama
2dfc58e904 support HTTP/1.0 keep alive (add corresponding header to response) 2014-09-20 06:30:18 +09:00
Antony Woods
f213e0d66e Culling url params 2014-09-15 17:28:15 +01:00
ipknHama
301587b469 fix example_chat crash bug when using (req, res) handler 2014-09-14 20:12:18 +09:00
ipknHama
532eb71e2b add pragma once to settings.h, set log level to DEBUG for unittest 2014-09-14 20:04:27 +09:00
Antony Woods
8299451271 Moved the 'completed = true' line to before the completion callbacks 2014-09-13 19:15:37 +01:00
ipknHama
507a1936e0 change default log level to INFO 2014-09-12 12:17:10 +09:00
ipknHama
b1b87a6c5a fix compile error
- add consturctor to request
 - remove unused type using
 - include "logging.h" from dumb_timer_queue.h (who uses CROW_LOG_DEBUG)
2014-09-12 12:17:10 +09:00
ipknHama
9eb96b7f4c Implement example CookieParser middleware and test 2014-09-11 06:32:41 +09:00
ipknHama
ab1063c046 complete middleware implementation 2014-09-08 07:07:53 +09:00
ipknHama
2748e35430 basic middleware test: before_handler 2014-09-07 04:30:53 +09:00
ipknHama
c89cafa820 add Middlewares template to Crow main class, context implementation 2014-09-07 01:24:45 +09:00
ipkn
daa3c82087 improve performance by 2x
change to io_service per CPU model
2014-08-17 05:35:21 -04:00
ipkn
79bbdfebfa fixed multithread crash 2014-08-16 12:10:19 -04:00
ipknHama
9b208fdaee fix compile bug (feeding std::endl to logger) 2014-08-16 12:44:43 +09:00
ipknHama
ef51b97d8b Change to custom timer implementation to increase performance 2014-08-16 11:55:26 +09:00
ipknHama
c5cbb3ff54 remove shared_ptr for performance 2014-08-15 11:06:00 +09:00
ipknHama
f91af402f7 Don't create logger object if corresponding log level is ignored. 2014-08-15 10:44:49 +09:00
ipknHama
9ca93dc799 Fixes #14, long polling leak removed. 2014-08-11 06:27:21 +09:00
ipknHama
001c66b378 amalgamation added 2014-08-08 01:14:27 +09:00
ipknHama
c36aa219e2 now crow becomes completely header only 2014-08-07 08:31:27 +09:00
ipknHama
81fcf4af01 decide to be header only 2014-08-07 06:18:21 +09:00
ipknHama
bd1481656a improve mustache.h 2014-08-07 05:55:31 +09:00
ipknHama
1b83b78c83 spliting header implementation into cpp files, routing.cpp created 2014-08-07 05:25:18 +09:00
ipknHama
031615ac86 source resturcturing + CMake 2014-08-07 01:18:33 +09:00