summaryrefslogtreecommitdiff
path: root/proc.c
AgeCommit message (Collapse)Author
2020-06-03proc: do not cancel script killing after writing headersSantiago Piccinini
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>
2019-06-16uhttpd: Fix multiple format string problemsHauke Mehrtens
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>
2018-04-24proc: expose HTTP Origin header in process environmentJo-Philipp Wich
Map the "Origin:" header as $HTTP_ORIGIN environment variable for use by request handling processes. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-04Revert "proc: avoid stdio deadlocks"Jo-Philipp Wich
This reverts commit ccd9717ba5d501b45fda957f0ea41c4660ef414c.
2018-01-25proc: avoid stdio deadlocksJo-Philipp Wich
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>
2017-07-02proc: expose HTTP_AUTH_USER and HTTP_AUTH_PASSJo-Philipp Wich
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>
2017-07-02proc: do not declare empty process variablesJo-Philipp Wich
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>
2015-08-17cgi: Support passing X-HTTP-Method-Override header.Karl Palsson
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>
2015-05-30proc: add HTTPS environment variableJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-03-21relay: do forward data if the http request type was HEADFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-07-31proc: consume all data after the pipe dies, instead of looping with 100% cpu ↵Felix Fietkau
usage Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-22proc: call read notify after more write space is availableFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-19implement support for script timeout for cgi/luaFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-13relicense to ISCFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-13fix cgi/lua header parsingFelix Fietkau
2013-01-13fix local/remote port env varsFelix Fietkau
2013-01-06de-constify the url parameter for the handler, it becomes invalid after the ↵Felix Fietkau
request anyway
2013-01-04add lua plugin supportFelix Fietkau
2013-01-04ensure the cgi postdata write pipe is closed for other processesFelix Fietkau
2013-01-04re-enable reads from the cgi pipe after enough data has been written to the ↵Felix Fietkau
client
2013-01-04plug a memory leak in cgi processingFelix Fietkau
2013-01-04free cgi headersFelix Fietkau
2013-01-03use pipes instead of a socketpair, EOF handling is broken with socketsFelix Fietkau
2013-01-03implement proper flow control for relaying postdataFelix Fietkau
2013-01-03fix use-after-realloc issue with the request urlFelix Fietkau
2013-01-03add post data relayingFelix Fietkau
2013-01-03cleanup dispatch struct accessFelix Fietkau
2013-01-02add local/remote address env vars for cgiFelix Fietkau
2013-01-02parse status header code from cgi scriptsFelix Fietkau
2013-01-01fix typo in header name checkFelix Fietkau
2013-01-01add preliminary cgi support, needs fixing for close handlingFelix Fietkau