summaryrefslogtreecommitdiff
path: root/proc.c
Commit message (Collapse)AuthorAgeFilesLines
* proc: do not cancel script killing after writing headersSantiago Piccinini2020-06-031-2/+0
| | | | | | | | | Before this change if the cgi script hangs after writing headers then the process will never be killed. Let's only cancel the timeout if the process ends. Signed-off-by: Santiago Piccinini <spiccinini@altermundi.net> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* uhttpd: Fix multiple format string problemsHauke Mehrtens2019-06-161-1/+2
| | | | | | | | | | | | | After format string checks were activated in libubox the compiler started to complain about multiple missuses in uhttpd. This fixes the format strings without changing the behavior. blobmsg_get_string() just checks if the parameter is not NULL and then calls blobmsg_data() and casts the result. I think non of these problem is security relevant. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* proc: expose HTTP Origin header in process environmentJo-Philipp Wich2018-04-241-0/+2
| | | | | | | Map the "Origin:" header as $HTTP_ORIGIN environment variable for use by request handling processes. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* Revert "proc: avoid stdio deadlocks"Jo-Philipp Wich2018-04-041-5/+1
| | | | This reverts commit ccd9717ba5d501b45fda957f0ea41c4660ef414c.
* proc: avoid stdio deadlocksJo-Philipp Wich2018-01-251-1/+5
| | | | | | | | | | | | | | | | | When a request handler accepting post data is too slow in consuming stdin, uhttpd might deadlock with the master process stuck in a blocking write() to the child and the child stuck with a blocking write() to the master. Avoid this issue by putting the master side write end of the child pipe into nonblocking mode right away and by raising the data_blocked flag when attempts to write to the child yield EAGAIN. Setting the flag ensures that client_poll_post_data() does not immediately trigger a write attempt again, which effectively yields the master write cycle so that the relay ustream has a chance to consume output of the client process, thus solving the deadlock. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* proc: expose HTTP_AUTH_USER and HTTP_AUTH_PASSJo-Philipp Wich2017-07-021-1/+5
| | | | | | | | | | Mimic other web servers like Nginx or Apache and expose the parsed basic auth information as HTTP_AUTH_USER and HTTP_AUTH_PASS environment variables to CGI processes. This also restores login-from-basic-auth functionality in LuCI. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* proc: do not declare empty process variablesJo-Philipp Wich2017-07-021-1/+1
| | | | | | | | If a HTTP header variable has no corresponding value, then do not set it to the empty string but to NULL, so that cgi.c will later skip it when setting up the process environment. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* cgi: Support passing X-HTTP-Method-Override header.Karl Palsson2015-08-171-1/+3
| | | | | | | | | | As uhttpd doesn't currently support PUT/DELETE/PATCH, allow passing the commonly used X-HTTP-Method-Override header to CGI scripts. This is an optional "protocol specific metadata" variable as per rfc 3875 section 4.1.18. Signed-off-by: Karl Palsson <karlp@remake.is>
* proc: add HTTPS environment variableJo-Philipp Wich2015-05-301-0/+3
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* relay: do forward data if the http request type was HEADFelix Fietkau2014-03-211-0/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* proc: consume all data after the pipe dies, instead of looping with 100% cpu ↵Felix Fietkau2013-07-311-3/+2
| | | | | | usage Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* proc: call read notify after more write space is availableFelix Fietkau2013-01-221-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* implement support for script timeout for cgi/luaFelix Fietkau2013-01-191-0/+15
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* relicense to ISCFelix Fietkau2013-01-131-12/+12
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix cgi/lua header parsingFelix Fietkau2013-01-131-12/+12
|
* fix local/remote port env varsFelix Fietkau2013-01-131-0/+2
|
* de-constify the url parameter for the handler, it becomes invalid after the ↵Felix Fietkau2013-01-061-2/+2
| | | | request anyway
* add lua plugin supportFelix Fietkau2013-01-041-3/+3
|
* ensure the cgi postdata write pipe is closed for other processesFelix Fietkau2013-01-041-1/+5
|
* re-enable reads from the cgi pipe after enough data has been written to the ↵Felix Fietkau2013-01-041-0/+11
| | | | client
* plug a memory leak in cgi processingFelix Fietkau2013-01-041-2/+3
|
* free cgi headersFelix Fietkau2013-01-041-0/+1
|
* use pipes instead of a socketpair, EOF handling is broken with socketsFelix Fietkau2013-01-031-52/+84
|
* implement proper flow control for relaying postdataFelix Fietkau2013-01-031-1/+17
|
* fix use-after-realloc issue with the request urlFelix Fietkau2013-01-031-1/+3
|
* add post data relayingFelix Fietkau2013-01-031-0/+36
|
* cleanup dispatch struct accessFelix Fietkau2013-01-031-7/+8
|
* add local/remote address env vars for cgiFelix Fietkau2013-01-021-4/+22
|
* parse status header code from cgi scriptsFelix Fietkau2013-01-021-0/+1
|
* fix typo in header name checkFelix Fietkau2013-01-011-1/+1
|
* add preliminary cgi support, needs fixing for close handlingFelix Fietkau2013-01-011-0/+241