project/uhttpd.git
6 years agorelay: do forward data if the http request type was HEAD
Felix Fietkau [Fri, 21 Mar 2014 20:27:30 +0000 (21:27 +0100)]
relay: do forward data if the http request type was HEAD

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
6 years agoubus: remove indentation and whitespace from JSON responses to conserve a bit of...
Jo-Philipp Wich [Wed, 27 Nov 2013 18:30:17 +0000 (18:30 +0000)]
ubus: remove indentation and whitespace from JSON responses to conserve a bit of bandwidth

6 years agouhttpd: fix crashes in the ubus plugin
Felix Fietkau [Thu, 21 Nov 2013 21:50:30 +0000 (22:50 +0100)]
uhttpd: fix crashes in the ubus plugin

The ubus plugin calls blocking ubus functions that loop back into
uloop_run. Protect the client data structure with refcounting to ensure
that the outer uloop_run call does not clean up the data that the inner
uloop_run call is still processing.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
6 years agolua: fix lua 5.2 compatibility
Felix Fietkau [Sun, 29 Sep 2013 13:38:34 +0000 (15:38 +0200)]
lua: fix lua 5.2 compatibility

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
6 years agomain: return after processing -d switch
Jo-Philipp Wich [Mon, 11 Nov 2013 20:12:12 +0000 (20:12 +0000)]
main: return after processing -d switch

7 years agoubus: use "ubus_rpc_session" instead of "sid" attribute name when querying session...
Jo-Philipp Wich [Fri, 13 Sep 2013 13:01:52 +0000 (15:01 +0200)]
ubus: use "ubus_rpc_session" instead of "sid" attribute name when querying session.access

7 years agoubus: fix session example script to conform to new rpc protocol
Jo-Philipp Wich [Fri, 13 Sep 2013 12:51:44 +0000 (14:51 +0200)]
ubus: fix session example script to conform to new rpc protocol

7 years agoubus: deny requests with a "ubus_rpc_session" toplevel attribute to prevent injecting...
Jo-Philipp Wich [Fri, 13 Sep 2013 12:44:57 +0000 (14:44 +0200)]
ubus: deny requests with a "ubus_rpc_session" toplevel attribute to prevent injecting different SIDs

7 years agoubus: pass current session id as ubus_rpc_session attribute to any called procedure
Jo-Philipp Wich [Thu, 8 Aug 2013 11:40:40 +0000 (13:40 +0200)]
ubus: pass current session id as ubus_rpc_session attribute to any called procedure

7 years agoubus: move sid into the params array of the json-rpc request to avoid information...
Jo-Philipp Wich [Wed, 7 Aug 2013 14:46:13 +0000 (16:46 +0200)]
ubus: move sid into the params array of the json-rpc request to avoid information leakage via the post url

7 years agoubus: use per-request blob buffer to fetch list results, fixes global buffer corrupti...
Jo-Philipp Wich [Sat, 8 Jun 2013 17:39:19 +0000 (19:39 +0200)]
ubus: use per-request blob buffer to fetch list results, fixes global buffer corruption with concurrent requests

7 years agoclient: prevent further read calls after a client has been freed
Felix Fietkau [Wed, 31 Jul 2013 16:29:03 +0000 (18:29 +0200)]
client: prevent further read calls after a client has been freed

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoproc: consume all data after the pipe dies, instead of looping with 100% cpu usage
Felix Fietkau [Tue, 30 Jul 2013 22:32:40 +0000 (00:32 +0200)]
proc: consume all data after the pipe dies, instead of looping with 100% cpu usage

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agodetect chrome before safari, chrome includes Safari/ in the UA header
Felix Fietkau [Fri, 26 Jul 2013 11:25:06 +0000 (13:25 +0200)]
detect chrome before safari, chrome includes Safari/ in the UA header

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agodisable connection_close override if a keep-alive header is found
Felix Fietkau [Fri, 26 Jul 2013 09:36:45 +0000 (11:36 +0200)]
disable connection_close override if a keep-alive header is found

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agodisable keep-alive for POST requests to improve compatibility
Felix Fietkau [Fri, 26 Jul 2013 09:36:18 +0000 (11:36 +0200)]
disable keep-alive for POST requests to improve compatibility

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoubus: fix handling of empty JSON-RPC batches
Felix Fietkau [Fri, 21 Jun 2013 09:25:29 +0000 (11:25 +0200)]
ubus: fix handling of empty JSON-RPC batches

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoubus: duplicate request buffer to avoid memory corruption with multiple requests
Jo-Philipp Wich [Sat, 8 Jun 2013 10:10:52 +0000 (12:10 +0200)]
ubus: duplicate request buffer to avoid memory corruption with multiple requests

7 years agoubus: use half of the script timeout as timeout for acl lookup call
Jo-Philipp Wich [Sat, 8 Jun 2013 07:48:35 +0000 (09:48 +0200)]
ubus: use half of the script timeout as timeout for acl lookup call

7 years agoubus: implement list method to enumerate objects and signatures
Jo-Philipp Wich [Tue, 4 Jun 2013 14:43:43 +0000 (16:43 +0200)]
ubus: implement list method to enumerate objects and signatures

7 years agorelay: cancel the timeout on free
Felix Fietkau [Sat, 1 Jun 2013 21:43:04 +0000 (23:43 +0200)]
relay: cancel the timeout on free

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoubus: clear the right timeout on rpc connection teardowns
Felix Fietkau [Thu, 30 May 2013 13:05:00 +0000 (15:05 +0200)]
ubus: clear the right timeout on rpc connection teardowns

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoubus: fix script timeout unit (seconds, not milliseconds)
Felix Fietkau [Thu, 30 May 2013 10:38:25 +0000 (12:38 +0200)]
ubus: fix script timeout unit (seconds, not milliseconds)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agorelay: do not process headers after the first error
Felix Fietkau [Thu, 23 May 2013 10:50:08 +0000 (12:50 +0200)]
relay: do not process headers after the first error

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agorelay: fix close handling
Felix Fietkau [Thu, 23 May 2013 10:41:03 +0000 (12:41 +0200)]
relay: fix close handling

When the relay process has exited, close the connection as soon as no
data can immediately be read from the socket anymore, and the read
buffer has been emptied.
This fixes timeouts with scripts that leave processes lingering around
without closing their fds.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agofix infinite loop when the initial two characters in a connection are \r\n
Felix Fietkau [Thu, 23 May 2013 10:35:44 +0000 (12:35 +0200)]
fix infinite loop when the initial two characters in a connection are \r\n

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agouhttpd: allow the config to override the default index file
Felix Fietkau [Thu, 16 May 2013 11:17:10 +0000 (13:17 +0200)]
uhttpd: allow the config to override the default index file

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agouhttpd: mark a TLS connections internally to clean up their state
Felix Fietkau [Tue, 14 May 2013 17:40:27 +0000 (19:40 +0200)]
uhttpd: mark a TLS connections internally to clean up their state

Fixes a per-SSL-connection memory leak

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoAccept square bracket notation for IPv6 addresses
Jo-Philipp Wich [Wed, 17 Apr 2013 11:30:19 +0000 (13:30 +0200)]
Accept square bracket notation for IPv6 addresses

7 years agotls: fix container_of use for casting the ssl ustream to client state
Felix Fietkau [Mon, 15 Apr 2013 14:48:57 +0000 (16:48 +0200)]
tls: fix container_of use for casting the ssl ustream to client state

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agolua: fix query string handling, the QUERY_STRING environment variable must not contai...
Jo-Philipp Wich [Mon, 18 Mar 2013 14:35:09 +0000 (15:35 +0100)]
lua: fix query string handling, the QUERY_STRING environment variable must not contain the leading question mark

7 years agoLoad plugins with RTLD_GLOBAL, fixes Lua library exports
Jo-Philipp Wich [Mon, 18 Mar 2013 14:35:08 +0000 (15:35 +0100)]
Load plugins with RTLD_GLOBAL, fixes Lua library exports

7 years agorelay: add a missing buffer availability check
Felix Fietkau [Fri, 15 Mar 2013 13:38:16 +0000 (14:38 +0100)]
relay: add a missing buffer availability check

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agodetect the right library name for json-c
Felix Fietkau [Tue, 12 Mar 2013 13:37:35 +0000 (14:37 +0100)]
detect the right library name for json-c

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoplugin.c: don't assume post_init callback to exist
Jo-Philipp Wich [Tue, 5 Mar 2013 15:40:45 +0000 (16:40 +0100)]
plugin.c: don't assume post_init callback to exist

7 years agoubus: use a default sid if authentication is disabled
Jo-Philipp Wich [Sat, 26 Jan 2013 14:14:55 +0000 (15:14 +0100)]
ubus: use a default sid if authentication is disabled

7 years agoset the docroot to the current working directory if none is specified, fixes random...
Jo-Philipp Wich [Sat, 26 Jan 2013 13:46:59 +0000 (14:46 +0100)]
set the docroot to the current working directory if none is specified, fixes random null pointer dereferencing

7 years agoubus: pass json rpc arguments to called ubus functions
Jo-Philipp Wich [Fri, 25 Jan 2013 19:10:45 +0000 (20:10 +0100)]
ubus: pass json rpc arguments to called ubus functions

7 years agoubus: add option to not authenticate ubus requests
Jo-Philipp Wich [Fri, 25 Jan 2013 16:49:44 +0000 (17:49 +0100)]
ubus: add option to not authenticate ubus requests

7 years agoubus: remove session api from plugin and check access via ubus call to let other...
Jo-Philipp Wich [Fri, 25 Jan 2013 14:35:10 +0000 (15:35 +0100)]
ubus: remove session api from plugin and check access via ubus call to let other services provide the session api

7 years agoubus: rename uloop_timeout_pending() to uloop_timeout_remaining()
Jo-Philipp Wich [Wed, 23 Jan 2013 18:36:16 +0000 (19:36 +0100)]
ubus: rename uloop_timeout_pending() to uloop_timeout_remaining()

7 years agomake arguments of not compiled functionality non-fatal
Jo-Philipp Wich [Wed, 23 Jan 2013 13:31:01 +0000 (14:31 +0100)]
make arguments of not compiled functionality non-fatal

7 years agoubus: expose remaining session lifetime in ubus session.list call
Jo-Philipp Wich [Tue, 22 Jan 2013 14:55:29 +0000 (15:55 +0100)]
ubus: expose remaining session lifetime in ubus session.list call

7 years agoproc: call read notify after more write space is available
Felix Fietkau [Tue, 22 Jan 2013 09:37:48 +0000 (10:37 +0100)]
proc: call read notify after more write space is available

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agodo not reset .notify_write on request done
Felix Fietkau [Tue, 22 Jan 2013 09:25:19 +0000 (10:25 +0100)]
do not reset .notify_write on request done

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoadd missing check for unencrypted passwords
Felix Fietkau [Mon, 21 Jan 2013 12:21:34 +0000 (13:21 +0100)]
add missing check for unencrypted passwords

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agodo not relay empty chunks, they look like EOF in chunked encoding
Felix Fietkau [Sat, 19 Jan 2013 22:55:10 +0000 (23:55 +0100)]
do not relay empty chunks, they look like EOF in chunked encoding

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoimplement support for script timeout for cgi/lua
Felix Fietkau [Sat, 19 Jan 2013 18:06:25 +0000 (19:06 +0100)]
implement support for script timeout for cgi/lua

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoadd support for deferring script requests, limit maximum number of script calls to...
Felix Fietkau [Sat, 19 Jan 2013 17:30:23 +0000 (18:30 +0100)]
add support for deferring script requests, limit maximum number of script calls to 3, maximum number of connections to 100

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoignore initial newlines in http requests
Felix Fietkau [Sat, 19 Jan 2013 15:48:05 +0000 (16:48 +0100)]
ignore initial newlines in http requests

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agofix container_of() on ustream callbacks
Felix Fietkau [Sat, 19 Jan 2013 15:47:37 +0000 (16:47 +0100)]
fix container_of() on ustream callbacks

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agopoll read data after connect as well
Felix Fietkau [Sat, 19 Jan 2013 15:07:15 +0000 (16:07 +0100)]
poll read data after connect as well

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agopoll connection after request completion when using keepalive
Felix Fietkau [Sat, 19 Jan 2013 15:00:34 +0000 (16:00 +0100)]
poll connection after request completion when using keepalive

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoproperly terminate headers of http responses without data, add Content-Length: 0
Felix Fietkau [Sat, 19 Jan 2013 14:53:33 +0000 (15:53 +0100)]
properly terminate headers of http responses without data, add Content-Length: 0

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agofix file etag buffer length
Felix Fietkau [Sat, 19 Jan 2013 12:41:39 +0000 (13:41 +0100)]
fix file etag buffer length

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agomove listener unblocking to a separate stack context via uloop timer
Felix Fietkau [Sat, 19 Jan 2013 12:39:47 +0000 (13:39 +0100)]
move listener unblocking to a separate stack context via uloop timer

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agoadd user agent detection for working around keepalive issues and add support for...
Felix Fietkau [Sat, 19 Jan 2013 12:10:53 +0000 (13:10 +0100)]
add user agent detection for working around keepalive issues and add support for the connection: close|keep-alive header

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agorelicense to ISC
Felix Fietkau [Sun, 13 Jan 2013 15:16:10 +0000 (16:16 +0100)]
relicense to ISC

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
7 years agofix cgi/lua header parsing
Felix Fietkau [Sun, 13 Jan 2013 10:59:36 +0000 (11:59 +0100)]
fix cgi/lua header parsing

7 years agofix redirect status
Felix Fietkau [Sun, 13 Jan 2013 10:50:50 +0000 (11:50 +0100)]
fix redirect status

7 years agofix local/remote port env vars
Felix Fietkau [Sun, 13 Jan 2013 10:47:42 +0000 (11:47 +0100)]
fix local/remote port env vars

7 years agopoll ustream after the process dies to fix eof detection
Felix Fietkau [Sun, 13 Jan 2013 10:30:15 +0000 (11:30 +0100)]
poll ustream after the process dies to fix eof detection

7 years agofix path lookup
Felix Fietkau [Sun, 13 Jan 2013 10:17:35 +0000 (11:17 +0100)]
fix path lookup

7 years agoadd an option for configuring http keepalive
Felix Fietkau [Sun, 13 Jan 2013 10:13:59 +0000 (11:13 +0100)]
add an option for configuring http keepalive

7 years agocheck for conf.error_handler before using it
Felix Fietkau [Sun, 13 Jan 2013 10:10:50 +0000 (11:10 +0100)]
check for conf.error_handler before using it

7 years agofix getting local server address
Felix Fietkau [Sun, 13 Jan 2013 09:50:42 +0000 (10:50 +0100)]
fix getting local server address

7 years agoadd check for shadow support, turn -Os back on
Felix Fietkau [Sun, 13 Jan 2013 09:17:31 +0000 (10:17 +0100)]
add check for shadow support, turn -Os back on

7 years agoadd missing file exists check
Felix Fietkau [Sun, 13 Jan 2013 09:10:03 +0000 (10:10 +0100)]
add missing file exists check

7 years agoremove unused data from the url in the session test script
Felix Fietkau [Sun, 13 Jan 2013 08:25:12 +0000 (09:25 +0100)]
remove unused data from the url in the session test script

7 years agorework the ubus plugin to support JSON-RPC 2.0
Felix Fietkau [Sun, 13 Jan 2013 08:24:04 +0000 (09:24 +0100)]
rework the ubus plugin to support JSON-RPC 2.0

7 years agoadd plugin op for uh_chunk_printf
Felix Fietkau [Sun, 13 Jan 2013 07:40:46 +0000 (08:40 +0100)]
add plugin op for uh_chunk_printf

7 years agoubus: split out session handling code into ubus-session.c
Felix Fietkau [Mon, 7 Jan 2013 15:47:13 +0000 (16:47 +0100)]
ubus: split out session handling code into ubus-session.c

7 years agofix typo
Felix Fietkau [Mon, 7 Jan 2013 11:54:40 +0000 (12:54 +0100)]
fix typo

7 years agofix prefix lookup
Felix Fietkau [Mon, 7 Jan 2013 02:03:08 +0000 (03:03 +0100)]
fix prefix lookup

7 years agoadd ubus support
Felix Fietkau [Mon, 7 Jan 2013 01:56:48 +0000 (02:56 +0100)]
add ubus support

7 years agoexport uh_http_header to plugins
Felix Fietkau [Mon, 7 Jan 2013 00:45:54 +0000 (01:45 +0100)]
export uh_http_header to plugins

7 years agoexport uh_request_done to plugins
Felix Fietkau [Mon, 7 Jan 2013 00:42:57 +0000 (01:42 +0100)]
export uh_request_done to plugins

7 years agode-constify the url parameter for the handler, it becomes invalid after the request...
Felix Fietkau [Sat, 5 Jan 2013 23:13:13 +0000 (00:13 +0100)]
de-constify the url parameter for the handler, it becomes invalid after the request anyway

7 years agoadd a c function for .send and .sendc
Felix Fietkau [Sat, 5 Jan 2013 13:17:21 +0000 (14:17 +0100)]
add a c function for .send and .sendc

7 years agoadd header table for lua calls
Felix Fietkau [Sat, 5 Jan 2013 13:13:14 +0000 (14:13 +0100)]
add header table for lua calls

7 years agofix uninitialized variables
Felix Fietkau [Fri, 4 Jan 2013 22:18:07 +0000 (23:18 +0100)]
fix uninitialized variables

7 years agoadd lua plugin support
Felix Fietkau [Fri, 4 Jan 2013 22:14:07 +0000 (23:14 +0100)]
add lua plugin support

7 years agoremove #ifdef HAVE_CGI
Felix Fietkau [Fri, 4 Jan 2013 18:39:13 +0000 (19:39 +0100)]
remove #ifdef HAVE_CGI

7 years agoadd basic tls support, todo: error handling
Felix Fietkau [Fri, 4 Jan 2013 17:28:10 +0000 (18:28 +0100)]
add basic tls support, todo: error handling

7 years agoget rid of -rdynamic on linking
Felix Fietkau [Fri, 4 Jan 2013 16:25:25 +0000 (17:25 +0100)]
get rid of -rdynamic on linking

7 years agofix relay ustream initialization
Felix Fietkau [Thu, 3 Jan 2013 14:54:57 +0000 (15:54 +0100)]
fix relay ustream initialization

7 years agoconstify mimetype list
Felix Fietkau [Fri, 4 Jan 2013 15:54:46 +0000 (16:54 +0100)]
constify mimetype list

7 years agoclean up directory listing code, only iterate over the set once (by sorting directori...
Felix Fietkau [Fri, 4 Jan 2013 15:52:53 +0000 (16:52 +0100)]
clean up directory listing code, only iterate over the set once (by sorting directories before files ahead of time)

7 years agoensure the cgi postdata write pipe is closed for other processes
Felix Fietkau [Fri, 4 Jan 2013 02:15:00 +0000 (03:15 +0100)]
ensure the cgi postdata write pipe is closed for other processes

7 years agore-enable reads from the cgi pipe after enough data has been written to the client
Felix Fietkau [Fri, 4 Jan 2013 01:30:59 +0000 (02:30 +0100)]
re-enable reads from the cgi pipe after enough data has been written to the client

7 years agoplug a memory leak in cgi processing
Felix Fietkau [Fri, 4 Jan 2013 00:20:54 +0000 (01:20 +0100)]
plug a memory leak in cgi processing

7 years agofix resuming accept() calls after exceeding client limit
Felix Fietkau [Fri, 4 Jan 2013 00:15:08 +0000 (01:15 +0100)]
fix resuming accept() calls after exceeding client limit

7 years agofree cgi headers
Felix Fietkau [Thu, 3 Jan 2013 23:23:58 +0000 (00:23 +0100)]
free cgi headers

7 years agouse pipes instead of a socketpair, EOF handling is broken with sockets
Felix Fietkau [Thu, 3 Jan 2013 21:45:18 +0000 (22:45 +0100)]
use pipes instead of a socketpair, EOF handling is broken with sockets

7 years agoimplement proper flow control for relaying postdata
Felix Fietkau [Thu, 3 Jan 2013 16:03:49 +0000 (17:03 +0100)]
implement proper flow control for relaying postdata

7 years agofix use-after-realloc issue with the request url
Felix Fietkau [Thu, 3 Jan 2013 14:01:50 +0000 (15:01 +0100)]
fix use-after-realloc issue with the request url

7 years agoclean up / fix #include
Felix Fietkau [Thu, 3 Jan 2013 13:13:56 +0000 (14:13 +0100)]
clean up / fix #include

7 years agolink against libcrypt
Felix Fietkau [Thu, 3 Jan 2013 13:13:13 +0000 (14:13 +0100)]
link against libcrypt

7 years agofix compile errors on linux
Felix Fietkau [Thu, 3 Jan 2013 12:50:59 +0000 (13:50 +0100)]
fix compile errors on linux

7 years agodo not send an error on a full buffer for post data
Felix Fietkau [Thu, 3 Jan 2013 02:33:24 +0000 (03:33 +0100)]
do not send an error on a full buffer for post data