Commit Graph

1983 Commits

Author SHA1 Message Date
Sergey Lyubka
d70c18d692 3.2 -> 3.3 2012-08-17 21:42:25 +01:00
Sergey Lyubka
9378946e7d Added comments in read_request() 2012-08-17 02:13:18 +01:00
Sergey Lyubka
d7e6492fac Refactored code that discards request data after handling 2012-08-17 01:49:36 +01:00
Sergey Lyubka
102101e9d6 Corrected dangerous assert() in process_new_connection 2012-08-16 22:48:29 +01:00
Sergey Lyubka
cf53f3da4f Revert "Added MG_SHUTDOWN event"
This reverts commit 15a0d819ed.
There is no point in MG_SHUTDOWN. Thread that calls mg_stop() can
do the same thing.
2012-08-16 20:20:18 +01:00
Sergey Lyubka
15a0d819ed Added MG_SHUTDOWN event 2012-08-16 17:24:33 +01:00
Sergey Lyubka
6add727c72 %zu printf spec is not understood by MS compiler, changing it to %lu 2012-08-16 11:33:16 +01:00
Sergey Lyubka
375950f6d7 Fixed hang for keep-alive connections 2012-08-16 00:05:46 +01:00
Sergey Lyubka
38d805933e Passing mg_connection to pull() function, in order to give it access to the stop status 2012-08-15 21:51:46 +01:00
Sergey Lyubka
941500f967 Sorted options list alphabetically 2012-08-15 21:40:43 +01:00
Sergey Lyubka
6619f2edac Implemented -x option 2012-08-14 16:06:10 +01:00
Sergey Lyubka
33853cd5de BUFSIZ -> MG_BUF_LEN 2012-08-14 13:32:24 +01:00
Sergey Lyubka
9a807aa7be Added If-None-Match support 2012-08-14 08:26:42 +01:00
Sergey Lyubka
4a5e1ecf92 Fixed error logging in set_ssl_option() 2012-08-11 10:29:08 +01:00
Sergey Lyubka
0e0091e1c0 Changing API: callback doesnt get mg_request_info pointer anymore, but it is possible to get it using mg_get_request_info() 2012-08-03 11:15:38 +01:00
Sergey Lyubka
e8f3132aa8 Added .json => text/json mime type. In handle_cgi_request, closing write stream straight after data is sent to the CGI process. 2012-08-03 00:10:01 +01:00
Sergey Lyubka
dccc524adb Fixed fseek() on large files on windows, using _lseeki64() and not casting to off_t 2012-08-02 15:41:39 +01:00
Sergey Lyubka
b42d25edd2 NOT exporting string functions 2012-07-31 23:52:46 +01:00
Sergey Lyubka
39215f6930 Exported mg_get_builtin_mime_type() 2012-07-31 08:58:44 +01:00
Sergey Lyubka
df7da95cb6 Setting Host header in mg_fetch. Added test for fetching large file. 2012-07-29 17:12:44 +01:00
Sergey Lyubka
4bc508525b Exported string functions 2012-07-29 14:04:48 +01:00
Sergey Lyubka
a9bb7d78ab Fixed mg_fetch() by passing a buffer, placeholder for the reply headers 2012-07-29 10:15:37 +01:00
Sergey Lyubka
e6bb39a2d3 Using client-side SSL context for mg_connect() 2012-07-28 18:57:04 +01:00
Sergey Lyubka
104480ed9c mg_start_thread() exported 2012-07-28 12:06:26 +01:00
Sergey Lyubka
c1ab21ecfe Argh, nasty typo fixed 2012-07-28 11:32:05 +01:00
Sergey Lyubka
6c54370aa1 Added mg_connect(), mg_fetch() API functions. More tests added 2012-07-28 11:04:03 +01:00
Sergey Lyubka
0b4676b711 More unit test for parse_http_header() 2012-07-14 10:29:38 -07:00
Sergey Lyubka
39fd804aeb Using BUFSIZ->16384 buffer size for the headers returned by CGI. BUFSIZ may be too small, e.g. 512 2012-06-15 22:38:49 +01:00
Sergey Lyubka
97392645c4 Refactored read_request() 2012-06-07 21:36:57 +01:00
Sergey Lyubka
9771d184f2 Squashed -DNO_SSL build warning 2012-06-06 06:45:23 +01:00
Sergey Lyubka
3ca6155add should_keep_alive() nitpick fix 2012-06-04 22:56:58 +01:00
Sergey Lyubka
594a37d51d refactored should_keep_alive() for better readability 2012-06-04 22:51:22 +01:00
Sergey Lyubka
5071978267 Corrected should_keep_alive() per bel2s suggestions 2012-06-04 22:49:16 +01:00
Sergey Lyubka
e6357396ef made readdir() static 2012-05-31 15:42:15 +01:00
Sergey Lyubka
bd3b812b82 Added index.shtml and index.php to index_files 2012-05-27 10:35:51 +01:00
Sergey Lyubka
4c5fee9673 Protect from DoS with negative Content-Length 2012-05-19 07:38:50 +01:00
Sergey Lyubka
cdd905c0fb Added #include <ws2tcpip.h> 2012-03-29 11:09:35 +01:00
Sergey Lyubka
5a22cb90b9 Fixing #327 2012-03-23 19:37:21 +00:00
Sergey Lyubka
9d4d48e703 Using mg_sleep() instead of sleep() 2012-03-13 21:17:03 +00:00
Sergey Lyubka
108a9739f4 3.1 -> 3.2 2012-03-11 22:54:12 +00:00
Sergey Lyubka
2824ae345d Added new event, MG_REQUEST_COMPLETE 2012-03-11 22:38:28 +00:00
Sergey Lyubka
a6678814af Checking malloc return code in worker_thread() 2012-03-11 22:25:27 +00:00
Sergey Lyubka
cda24d94fb Fixed overflow in substitute_index_file() 2012-03-11 22:19:12 +00:00
Sergey Lyubka
f085e68baf Added check for the duplicate option 2012-03-11 22:14:50 +00:00
Sergey Lyubka
b78110b92e Using MSG_NOSIGNAL in send() 2012-03-11 21:58:04 +00:00
Sergey Lyubka
37503c78c8 setting conn->must_close = 1; in handle_propfind() 2012-03-11 21:52:12 +00:00
Sergey Lyubka
83447fb6e5 Fix Windows build 2012-03-11 21:32:53 +00:00
Sergey Lyubka
2a3f31f521 Using g++ for compilation. Fixed C++ build. 2012-03-06 20:19:47 +00:00
Sergey Lyubka
dcecfadbeb Use static initialization for STARTUPINFO and PROCESS_INFORMATION 2012-03-04 19:40:25 +00:00
Sergey Lyubka
5faa2de3f5 Directory request closes the connection 2012-03-04 16:24:18 +00:00
Sergey Lyubka
6dc1b347a0 Various fixes from bel2125, http://code.google.com/r/bel2125-mongoose/source/detail?r=9fe067d34a3f3a7311f86627b8e1ecb7719a663d 2012-03-04 16:00:12 +00:00
Sergey Lyubka
c88f736971 Removed DEBUG_TRACE from convert_uri_to_file_name() 2012-02-22 18:30:59 +00:00
Sergey Lyubka
b10b989865 Increasing master thread priority on Windows 2012-02-20 23:27:40 +00:00
Sergey Lyubka
ba8b07387c Issue 317: increase priority of the master thread 2012-02-20 18:44:02 +00:00
Sergey Lyubka
d05b7b06aa PATH_INFO support 2012-02-20 18:42:32 +00:00
Sergey Lyubka
6576a783da Remove proxy code 2012-02-12 08:49:59 +00:00
lsm
86e3cd262b Using IS_DIRSEP_CHAR() in remove_double_dots_and_double_slashes() 2012-02-10 22:01:42 +00:00
Sergey Lyubka
84a76fba69 Remove repeating backslashes only on Windows 2012-02-09 22:53:56 +00:00
Sergey Lyubka
76dd31055e Exporting SystemDrive environment variable for CGIs on Windows 2012-02-05 13:04:52 +00:00
Sergey Lyubka
b5ed7ed7d1 Changed NO_IPV6 to USE_IPV6. Also, using inet_ntop() everywhere. 2012-02-05 12:27:58 +00:00
Sergey Lyubka
7af9df9fab Added preliminary IPv6 support 2012-02-01 21:50:22 +00:00
Sergey Lyubka
6905a9a0cb Formatting changes 2012-01-30 18:56:17 +00:00
Sergey Lyubka
f56dcb8989 removed match_extension() 2012-01-29 21:22:42 +00:00
valenok
8ea40bae4b Introduced $ meta character in glob expressions 2012-01-26 03:21:51 +00:00
valenok
905413b656 Fix issue 300 2012-01-24 16:05:07 +00:00
valenok
ed70793670 Options ssi_extensions, cgi_extensions became cgi_pattern, ssi_pattern 2012-01-24 09:30:01 +00:00
valenok
01c5ee0973 Added -w option 2012-01-23 22:03:36 +00:00
Sergey Lyubka
aa90972a31 Set code 302 automatically if CGI reply has Location: header present 2011-11-06 11:24:23 +01:00
Sergey Lyubka
8601b03ead Do not set Connection: keep-alive unless -enable_keep_alive is set 2011-11-06 10:04:55 +01:00
Sergey Lyubka
4e551d9a1d Copyright year changed to 2011. Fixed documentation string for mg_get_cookie() 2011-08-26 21:30:20 +01:00
Sergey Lyubka
5edfe797f1 Using _beginthread() for starting threads on Windows 2011-08-26 13:03:15 +01:00
Sergey Lyubka
8442a9ceea Fix stuck master thread in produce_socket() by always signalling sq_empty from the worker threads 2011-08-26 10:19:19 +01:00
Sergey Lyubka
5d70ffe878 parse_date_string() interprets time in UTC, as per standrard 2011-08-26 08:57:04 +01:00
Sergey Lyubka
f749eeb795 Style changes: using C++ comments everywhere 2011-08-25 16:57:17 +01:00
Sergey Lyubka
60408deaa8 Fix -DNO_CGI build 2011-08-24 13:11:41 +01:00
Sergey Lyubka
bc900844f1 Added .mp4 and .m4v mime types 2011-08-24 13:05:49 +01:00
Sergey Lyubka
a49c688d48 Fixed directory traversal security issue for windows 2011-08-24 12:55:08 +01:00
Sergey Lyubka
ba714de066 Added directory listing support to the PROPFIND method 2011-08-24 08:24:20 +01:00
Colin Leitner
015ddf8ac1 Basic PROPFIND support. Not capable of listing a directory yet. 2011-08-20 12:13:23 +02:00
Colin Leitner
22754f403d Fixed bug in handle_directory_request, that used the unintialized path variable instead of dir for an error message. 2011-08-20 11:49:50 +02:00
Colin Leitner
a021ebf4c4 Added OPTIONS method 2011-08-20 11:48:31 +02:00
Sergey Lyubka
025b11b176 Fixed buffer overflow in put_dir() 2011-08-03 11:39:55 +02:00
valenok
27983c535d All dates in headers must be in UTC 2011-07-26 00:39:05 +01:00
valenok
9be6774197 Breaking process_new_connection() loop when mg_stop() is called 2011-07-04 13:01:18 +01:00
valenok
99f5f11612 Fix SEGV in handle_proxy_request 2011-06-28 15:33:40 +01:00
valenok
a844115043 close_socket_gracefully(): set linger option to prevent port exhaustion 2011-06-24 08:31:37 +01:00
valenok
71b6a53617 spawn_process(): reading hashbang string correctly on Windows 2011-06-23 00:07:46 +01:00
valenok
5303e37702 Allow NULL passwords in mg_modify_passwords_file 2011-06-22 14:01:10 +01:00
valenok
ff28c04b60 Corrected errror message in set_ports_option() 2011-06-22 08:37:11 +01:00
valenok
a77519def3 Uninitializing SSL on mg_stop() 2011-06-22 08:35:08 +01:00
valenok
8942a4cdad Ignoring SIGCHLD to let OS reap the zombies. 2011-06-22 00:45:08 +01:00
valenok
9e524a2fce Changed backlog length, listen(20) -> listen(100) 2011-06-21 22:47:44 +01:00
valenok
5bbb6fbbd5 Added mg_send_file() 2011-06-19 17:45:52 +01:00
valenok
23a3cc6472 Added "Content-Length: 0" to the authorization reply to make it keep-alive friendly 2011-06-18 10:21:13 +01:00
valenok
377cece9c0 Better comments for TCP keep-alive change 2011-05-26 21:15:34 +01:00
valenok
abc230eb34 Set keep alive on TCP level 2011-05-26 21:12:44 +01:00
valenok
938407dc16 3.0 -> 3.1 2011-05-02 08:59:58 +01:00
valenok
d7cba57e17 Make source g++ friendly 2011-04-24 22:40:08 +01:00
Sergey Lyubka
cb601b7718 Fix potential leak in handle_directory_request() 2011-03-31 18:04:46 +02:00
Sergey Lyubka
6a43bd952f Fix pthread_cond_wait() to prevent race 2011-03-31 17:59:23 +02:00
valenok
ec15f2da2b Fixed assert() in mg_read() 2011-03-08 21:51:03 +00:00
valenok
3e48cebc13 MD5Update(): memset() call corrected 2011-03-07 17:34:40 +00:00
valenok
be20ced0a1 parse_url() fixed 2011-03-06 23:30:34 +00:00
valenok
2557884179 Added __SYMBIAN32__ conditionals 2011-03-06 22:48:31 +00:00
valenok
b489cb6c76 Bug in SSL defines fixed, thanks to mmeuli 2011-03-05 12:38:48 +00:00
valenok
4840457927 Passing request_info with user_data to MG_INIT_SSL 2011-03-05 09:01:38 +00:00
valenok
80d9fbcda4 Passing user_data into MG_INIT_SSL as 3rd parameter 2011-03-05 08:49:50 +00:00
valenok
fae26c1bfd Style cleanup 2011-02-19 12:00:46 +00:00
valenok
29716fa22e Changed API: function mg_modify_passwords_file(). Instead of passing context, a domain name is passed, thus making this function completely mongoose-agnostic. 2011-02-18 16:40:58 +00:00
valenok
3583e83a3f Using volatile keyword in the context struct to prevent unwanted optimization. See http://code.google.com/p/mongoose/issues/detail?id=216 2011-02-15 16:13:38 +00:00
Arnout Vandecappelle (Essensium/Mind)
a57f2cf744 Do authentication before trying NEW_REQUEST callback. 2010-12-03 13:16:34 +01:00
Arnout Vandecappelle (Essensium/Mind)
a9b6eb1809 Fix for issue#209: support spaces, commas, quotes and other weirdness in Authorization header. 2010-12-03 12:48:56 +01:00
Arnout Vandecappelle (Essensium/Mind)
d9c05f9910 Partial fix for issue#209: don't crash when some Authorization fields are missing. 2010-12-02 17:48:08 +01:00
Sergey Lyubka
ac09360430 Accept * URI 2010-11-29 18:27:25 +01:00
Sergey Lyubka
9bda69f573 Fix issue 180 - make mg_read() handle PUT requests, too. Stop checking for request method in mg_read(). 2010-11-29 17:56:26 +01:00
Arnout Vandecappelle (Essensium/Mind)
fb9493a090 Bugfix of Issue #180: mg_read() should accept PUT requests. 2010-11-29 16:27:30 +01:00
Sergey Lyubka
0db96c5ba5 make it possible to set SSL_LIB and CRYPTO_LIB during build 2010-11-29 14:46:42 +01:00
Sergey Lyubka
e97762879d reduced select() timeout from 1 second to 0.2 second to make mongoose snappier 2010-11-29 14:39:04 +01:00
Sergey Lyubka
db1c0806ef Parsing auth header - fix issue 206, IE case 2010-11-29 14:28:52 +01:00
Sergey Lyubka
1de7fef760 fix blocked CGI read 2010-11-15 10:41:17 +01:00
valenok
da21192b10 squashed a warning 2010-11-03 07:46:59 +00:00
valenok
073890215d RTEMS fixes: removed mman.h include, and introduced NO_POPEN conditional 2010-11-03 07:37:59 +00:00
Arnout Vandecappelle (Essensium/Mind)
bdb396cc5d Bugfix of Issue #200: Multiple calls to mg_read always return the same data.
The buffer must skip over consumed_content.
2010-11-02 11:14:43 +01:00
Matt Healy
c1e24ac7f9 Resolved various compile-time warnings when building code. (This is due to
requirements on some projects I work on, where warning levels must be kept
to a minimum.)
2010-10-30 15:49:12 -04:00
valenok
11951a57ff API change: added void *user_data to mg_start(). Bumped version to 3.0 2010-10-26 23:37:44 +01:00
valenok
7034f49276 should_keep_alive(): using mg_strcasecmp() instead of strcmp() to compare header value 2010-10-05 07:08:51 +01:00
valenok
6240455779 2.11 -> 2.12 2010-10-05 07:06:53 +01:00
valenok
9390b00166 squash warning under win32 2010-09-26 22:27:41 +01:00
valenok
51b1f3a021 Under Linux, reap CGI zombies reliably 2010-09-26 22:20:20 +01:00
valenok
66ba1259f2 CGI script execution fixed for windows 2010-09-20 19:23:40 +01:00
valenok
7865ed7bad SCRIPT_FILENAME should be relative to document root, and begin with slash. 2010-09-19 21:57:34 +01:00
valenok
1811240587 exporting correct SCRIPT_FILENAME for CGI 2010-09-19 13:00:49 +01:00
valenok
3e5d2bd3ac extra check in mg_start(): options may be NULL 2010-09-18 04:20:10 +01:00
valenok
d475188a3d protected free(ssl_mutexes) with ifndef NO_SSL 2010-09-14 11:16:30 +01:00
valenok
9b5de49437 free-ing allocated SSL mutexes 2010-09-12 22:44:02 +01:00
valenok
ea71faf71d 2.10 -> 2.11 2010-09-12 22:26:12 +01:00
valenok
2b732a8067 implemented pthread_cond_broadcast() better to avoid mg_stop() deadlock on Win32 2010-09-12 21:58:22 +01:00
valenok
bd152b0923 introduced max_request_size 2010-09-11 16:53:23 +01:00
valenok
3d43451b36 reporting error if request size is too big 2010-09-10 23:44:23 +01:00
valenok
d8c12e449d refactored set_port_option 2010-09-09 13:46:05 +01:00
valenok
4c1451bab1 refactored SSL initialization. implemented mg_connect() 2010-09-08 22:53:25 +01:00
valenok
1ceafea1f9 SSL_CTX_use_certificate_chain_file() call fixed. using __cdecl for qsort callback. squashed warnings under msvc 2010-09-07 10:59:31 +01:00
valenok
149a553872 not setting SO_REUSEADDR on windows 2010-09-06 21:58:05 +01:00
valenok
236768b30c 2.9 -> 2.10 2010-09-06 21:46:07 +01:00
valenok
de5aff7f10 fixed check_acl() to return -1 for malformed ACL 2010-09-06 21:36:54 +01:00
valenok
28f3073873 added -DNO_SSL_DL option 2010-09-03 03:58:23 +01:00
valenok
0f89d437d5 added -ssl_chain_file option 2010-08-31 21:19:27 +01:00
valenok
5a0376488d rearranged options list in alphabetical order 2010-08-31 21:10:19 +01:00
Sergey Lyubka
75b6717d8b wrapped set_ssl_option call into NO_SSL conditional. Fixed test. 2010-08-31 11:58:45 +02:00
valenok
f105b74dc0 experimental keep-alive, options defaults 2010-08-31 08:01:14 +01:00
valenok
a0e202d828 fixed win32 build 2010-08-31 00:12:16 +01:00
valenok
64ca2965c0 disabled SSL handshake error messages 2010-08-30 23:41:17 +01:00
valenok
68dde1b7b1 error message in set_ssl_option() corrected 2010-08-30 17:56:43 +01:00
valenok
97f2155239 introduced short option names 2010-08-30 13:10:10 +01:00
valenok
bb21ffec12 moved document_root verification to standalone server (into main.c) 2010-08-30 12:54:46 +01:00
valenok
39c6d3ee08 corrected error log message in spawn_process() 2010-08-30 10:35:04 +01:00
valenok
6cf296515b added debug trace in mg_start. restored stderr duping in spawn_process() 2010-08-29 23:19:53 +01:00
valenok
546bec333c API change for mg_start: most binary compatible across releases. 2010-08-29 22:30:49 +01:00
valenok
e846212180 embedded mode: implement mg_read() properly. This brings straming support to Mongoose. 2010-08-28 00:31:06 +01:00
valenok
ee997ba7d4 put back dynamic SSL lib loading 2010-08-26 20:50:59 +01:00
valenok
4f716e2b9a fixed win32 build 2010-08-26 00:55:03 +01:00
valenok
8d2bc8dd8a squash MinGW warning 2010-08-23 21:46:28 +01:00
valenok
f4907bc0c2 introdused NO_SSL. Explicitely linking against SSL library. 2010-08-23 21:36:35 +01:00
valenok
cb71dc4a1e integrated Michael Krelin fixes: no extra newline in error logs, no #ifndef NO_CGI for match_extension() 2010-08-23 20:48:40 +01:00
valenok
b6d53922d2 s/FILENAME_MAX/PATH_MAX/g, also allocating connections on heap 2010-08-23 19:58:45 +01:00
Sergey Lyubka
aca0512173 optimized DEBUG_TRACE(). Fixed thread sync on exit. 2010-08-23 17:42:25 +02:00
Sergey Lyubka
fcb57df105 creating all worker threads in mg_start(). 2010-08-23 14:06:58 +02:00
valenok
e650941174 fixed bad http version handling 2010-08-23 07:26:03 +01:00
valenok
d87cd36beb removed partial copyright - no relevant code. adopted CGI code to no post_data. Embedded mode is still todo. FALSE -> MG_FALSE. 2010-08-23 07:11:35 +01:00
valenok
4cf7851996 decreased thread idle time to 5 seconds. exiting worker thread if stop flag is raised. 2010-07-06 23:04:50 +01:00
valenok
9a2b2d75f1 adopted mongoose.c to Google style 2010-07-06 17:41:21 +01:00
valenok
88a224d808 fixed example. some more comments added 2010-07-05 19:37:53 +01:00
Sergey Lyubka
5425b94f39 introduced struct mg_config. Fixed Range response. 2010-06-25 17:23:17 +02:00
valenok
9a5f96e755 Win32 compilation fixed 2010-06-15 12:49:52 +03:00
migal
f9456c4d76 removed MAX_LISTENING_SOCKETS restriction 2010-06-05 16:30:50 +03:00
Sergey Lyubka
e8db81e33b SSL error logging my Martin Lamb 2010-05-28 15:52:58 +01:00
mlamb
57157edc66 don't close the error log if we didn't open it. 2010-05-28 10:28:45 -04:00
mlamb
c511671e33 formatting 2010-05-27 17:36:55 -04:00
mlamb
22322f2851 Add ssl_cry() function to display error message plus any detailed error messages that OpenSSL might care to provide.
This can help to debug SSL communication issues.

Example output with a couple of problematic SSL client sessions (new log messages start with "-->" to indicate that they are providing additional detail to a previous log message):

Mongoose "2.9, $Rev: 517 $" started on port(s) "80,443s", serving directory "."
[1274991792] [error] [client 10.50.50.50] worker_thread: SSL handshake error
[1274991792] [error] [client 10.50.50.50]   --> error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
[1274991882] [error] [client 10.50.50.50] worker_thread: SSL handshake error
[1274991882] [error] [client 10.50.50.50]   --> error:1408A0C1:SSL routines:SSL3_GET_CLIENT_HELLO:no shared cipher
2010-05-27 15:44:59 -04:00
Sergey Lyubka
ddde5d9d1b range support for PUT request by Yan Jabin 2010-05-21 11:51:49 +02:00
lsm
d94c3f8b64 moved linux-specific compilation #defines into mongoose.c. This way we make sure flags are picked up if Makefile is not used. 2010-05-08 14:06:35 +02:00
Sergey Lyubka
627a6dbb5a mg_md5 made public 2010-05-05 00:39:36 +01:00
Sergey Lyubka
a69a2da39d Initial import - converting from Subversion. 2010-05-03 21:46:42 +01:00