1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-12-22 04:02:04 +03:00
Commit Graph

1741 Commits

Author SHA1 Message Date
bel
a1d9858c15 Performance optimization for the form handling example in Lua
Optimization of example for question ("issue") #70:

Concatenating many strings in a loop in Lua is not efficient.
The standard solution for this is a Lua string builder pattern:
Store all strings in a table and use table.concat
2015-03-18 00:34:26 +01:00
bel
821a36af17 Add example how to handle form data and file upload in Lua
The Lua code example is from the Civetweb discussion group:
https://groups.google.com/forum/#!topic/civetweb/m9ojynOyzU4

This is also an example that might answer a question posted as an issue in Github:
https://github.com/bel2125/civetweb/issues/70
Question: how to get header, parse POSTed content in Lua? (issue #70)
2015-03-18 00:34:23 +01:00
bel
a20cf868b3 Fix CGI environment variables (issue #75) 2015-03-18 00:34:20 +01:00
bel
cb098f5bbd Add TCP_USER_TIMEOUT to deal faster with broken connections.
Merge a similar fix from an old, MIT licensed clone:
https://code.google.com/r/bel2125-mongoose/source/browse/mongoose.c?spec=svn9a7158cc6b224ec1f75d19ca377a8af66b8fd873&r=9a7158cc6b224ec1f75d19ca377a8af66b8fd873
2015-03-18 00:34:17 +01:00
bel2125
9a303f3655 Merge pull request #74 from marklakata/master
Added exception if CivetServer constructor fails. Added getListeningPort...
2015-03-12 23:17:07 +01:00
Mark Lakata
fc3dc6eea8 fixed cut and paste error 2015-03-12 14:45:26 -07:00
Mark Lakata
82a7ed8b53 Added exception if CivetServer constructor fails. Added getListeningPorts() method. 2015-03-12 14:38:27 -07:00
bel
b14ab7b00a Rewrite open all Lua libraries 2015-03-08 21:35:54 +01:00
bel
66f424552d Fix bug in implementation of issue #65 2015-03-07 23:57:17 +01:00
bel
e2eb7f0e76 Adjust white space policy of merge from pull request #66 2015-03-07 21:26:55 +01:00
bel
2a3526946e Rename function from pull request #66 2015-03-07 21:10:05 +01:00
bel2125
c7e3e58dbf Merge pull request #66 from yehudasa/wip-fast-forward
fast forward request data on completion of begin_callback()
2015-03-07 21:05:10 +01:00
bel2125
d435223630 Merge pull request #73 from MrSpider/master
Call of handler before context save (C++ Wrapper)
2015-03-07 21:02:35 +01:00
Philipp Friedenberger
c0a952e971 fix return 2015-02-27 19:56:55 +01:00
Philipp Friedenberger
2f7f94bbfc check if context is initialized 2015-02-27 19:49:47 +01:00
bel
a069ec2018 Lua function to access a high resolution clock (monotonic and realtime) 2015-02-26 22:01:02 +01:00
bel
0b286e4db3 Add assert to check if getreq still works as expected 2015-02-25 21:20:01 +01:00
bel
d4ed0a682a process_new_connection should always close the connection on errors 2015-02-20 21:14:51 +01:00
bel2125
a189fcc712 Merge pull request #71 from MrSpider/master
fixed PRINTF_ARGS for send_http_error(...)
2015-02-15 15:53:26 +01:00
bel2125
11905e95eb Fix PRINTF_ARG define for gcc
Argument position was shifted with commit:
Remove unused argument of send_http_error
2015-02-14 21:16:08 +01:00
bel
4894f62e51 Return more differentiated HTTP error codes (cleanup pull request #67) 2015-02-14 00:15:01 +01:00
Philipp Friedenberger
81768c3e17 fixed PRINTF_ARGS for send_http_error(...) 2015-02-14 00:12:36 +01:00
bel
281a839eba Update CREDITS.md 2015-02-13 23:18:25 +01:00
bel2125
d7e9d19fa9 Merge pull request #69 from yehudasa/wip-setgroups
call setgroups() to avoid supplemental group leakage
2015-02-13 21:59:54 +01:00
bel2125
fbdd131151 Merge pull request #68 from yehudasa/wip-log-access
Wip log access

Add a log_header callback function.
2015-02-13 21:49:19 +01:00
bel2125
a774a6e32e Merge pull request #67 from yehudasa/wip-send-500
don't always send 500 if couldn't get request
2015-02-13 21:42:41 +01:00
Yehuda Sadeh
3b586462f4 Abort early on a bad content length
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
2015-02-12 16:18:46 -08:00
Yehuda Sadeh
a3c460c209 call setgroups() to avoid supplemental group leakage
Calling setgroups() between setgid() and setuid().

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
2015-02-12 16:14:51 -08:00
Yehuda Sadeh
bab2a3f627 add log_access() callback
log_message() is used for critical messages, log_access() used for
access logging.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
2015-02-12 16:12:25 -08:00
Yehuda Sadeh
1d7efd0697 send access logs to the .log_message() callback
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
2015-02-12 16:09:36 -08:00
Yehuda Sadeh
e066bf70ff don't always send 500 if couldn't get request
No need to send 500 if connection closed. We may want to send other
responses in other cases (e.g., 400).

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
2015-02-12 16:03:26 -08:00
Yehuda Sadeh
5e0f3cfba4 fast forward request data on completion of begin_callback()
backend might not have read all data, we need to make sure we flush all
incoming data.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
2015-02-12 15:59:44 -08:00
bel
749b0d8267 Remove unused argument of send_http_error 2015-02-07 22:07:59 +01:00
bel
bbf30afbd6 reason argument in send_http_error should no longer be used 2015-02-07 19:52:02 +01:00
bel
379dae3cc2 pollfd for MinGW (see issue #57) 2015-02-04 00:21:26 +01:00
bel
c70d1ecad8 Update copyright note to 2015 2015-02-03 23:18:59 +01:00
bel
ae404df3a8 Fix mingw compiler error 2015-02-02 23:22:00 +01:00
bel
e7354dbf9d Comment the behavior of GET/POST/PUT/DELETE on script files
See issue #65 for further details
2015-01-25 00:04:47 +01:00
bel
7b071cb28c Handle PUT/DELETE to *.cgi as a request to replace/remove the script file
Restore behavior of previous release version
GET xy.cgi calls xy.cgi and returns the page generated by the script
POST xy.cgi calls xy.cgi and returns the page generated by the script
PUT xy.cgi replaces xy.cgi by the new content
DELETE cx.cgi removes xy.cgi
GET xy.cgi/* calls xy.cgi and returns the page generated by the script
POST xy.cgi/* calls xy.cgi and returns the page generated by the script
PUT xy.cgi/* calls xy.cgi and returns the page generated by the script
DELETE xy.cgi/* calls xy.cgi and returns the page generated by the script
See issue #65: CGI POST is no longer working
2015-01-23 23:30:49 +01:00
bel
6e98a7f364 Treat CGI scripts and Lua scripts as script resources, so POST, PUT, DELETE, ... are handled by the scripts
See issue #65: CGI POST is no longer working
2015-01-23 23:07:02 +01:00
bel
37b1879d1f Fix compile errors (original LuaXML_lib.c is not strict C)
There are many compile errors in the original LuaXML_lib.c file,
when using a MSVC C compiler. It does not define variables at the
beginning of a function, which is allowed in C++ but not in C.
This seems to be a non-standard gcc extention, which must not be
used within civetweb.
These changes might be required for all new versions of this
third party component. Maybe on the long term this library should
be replaced or rewritten.
2015-01-23 17:54:12 +01:00
bel
c982982280 Fix some obsolete TODOs 2015-01-13 23:18:30 +01:00
bel
7e54bb6dd5 fix time calculation in pthread_cond_timedwait implementation for Windows 2015-01-13 23:18:24 +01:00
bel2125
01641d189b LuaXML must export xml as global 2015-01-08 23:49:12 +01:00
bel2125
8f84f82a36 Update LuaXML to version 1.8.0
Version 1.8.0 from http://viremo.eludi.net/LuaXML/#download,
download Jan 8, 2015
2015-01-08 23:27:41 +01:00
bel2125
b6088ee7eb Add a define SSL_ALREADY_INITIALIZED
This define should be set if civetweb is embeded into a host application
that did already set up SSL (libcrypto).
See also comment "cryptolib_users = 1", issue #58
2015-01-07 23:16:35 +01:00
bel2125
5e9859510b Add documentation on the working path used for Lua scripts
Document that Lua uses the current working path of the process.
See also issue #56.
2015-01-06 21:09:32 +01:00
bel2125
fad1fc5b97 Merge pull request #59 from Foran/master
Fixed spelling error
2015-01-06 17:31:24 +01:00
Ben M. Ward
c2ea3cc376 Fixed spelling error 2015-01-06 08:10:32 -07:00
bel
a5eadbca86 Fix multiple file upload (issue #55) 2015-01-05 15:05:01 +01:00