summaryrefslogtreecommitdiff
path: root/client.c
AgeCommit message (Collapse)Author
2016-06-16uhttpd: add support for adding arbitrary headers via handler scriptsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2015-10-08fix chunked transfer encoding in keepalive modeJo-Philipp Wich
The two commits 5162e3b0ee7bd1d0fd6e75e1ca7993a1834b5291 "allow request handlers to disable chunked reponses" and 618493e378e2239f0d30902e47adfa134e649fdc "file: disable chunked encoding for file responses" broke the chunked transfer encoding handling for proc responses in keep-alive connections that followed a file response with http status 204 or 304. The effect of this bug is that cgi responses following a 204 or 304 one where sent neither in chunked encoding nor with a content-length header, causing browsers to stall until the keep alive timeout was reached. Fix the logic flaw by inverting the chunk prevention flag in the client state and by testing the chunked encoding preconditions every time instead of once upon client (re-)initialization. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-30client: use 307 instead of 302 for HTTPS redirectsJo-Philipp Wich
Use the 307 code to force agents to retain the original request method. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-30add support for enforcing HTTPSJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-30allow request handlers to disable chunked reponsesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27client: store http code of last emitted responseJo-Philipp Wich
Certain response types (notably 204 and 304) require a slightly different handling like emitting the response body entirely, therfore record the last code to act on it in the appropriate places. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-06-10ubus: add CORS header supportJo-Philipp Wich
In order to support cross-domain AJAX requests to the /ubus endpoint we need to implement the Cross-Origin Resource Sharing (CORS) spec in the ubus plugin. - Implement a new option "-X" to enable CORS support in ubus - Implement rudimentary support for "OPTIONS" HTTP requests - Implement essential CORS headers the ubus plugin The current CORS response headers merely reflect the request headers sent by the client, this way any requesting origin is automatically allowed. Cross-domain cookies (Access-Control-Allow-Credentials) are unconditionally enabled. Restricting permitted origins and toggle the credential accepting can be made configurable in a future commit to allow more fine grained control over permitted AJAX clients. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2013-11-21uhttpd: fix crashes in the ubus pluginFelix Fietkau
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>
2013-07-31client: prevent further read calls after a client has been freedFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-07-26detect chrome before safari, chrome includes Safari/ in the UA headerFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-07-26disable connection_close override if a keep-alive header is foundFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-07-26disable keep-alive for POST requests to improve compatibilityFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-23fix infinite loop when the initial two characters in a connection are \r\nFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-14uhttpd: mark a TLS connections internally to clean up their stateFelix Fietkau
Fixes a per-SSL-connection memory leak Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-22do not reset .notify_write on request doneFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-19add support for deferring script requests, limit maximum number of script ↵Felix Fietkau
calls to 3, maximum number of connections to 100 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-19ignore initial newlines in http requestsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-19fix container_of() on ustream callbacksFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-19poll read data after connect as wellFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-19poll connection after request completion when using keepaliveFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-19add user agent detection for working around keepalive issues and add support ↵Felix Fietkau
for the connection: close|keep-alive header 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 getting local server addressFelix Fietkau
2013-01-04add basic tls support, todo: error handlingFelix Fietkau
2013-01-04fix resuming accept() calls after exceeding client limitFelix 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-03do not send an error on a full buffer for post dataFelix Fietkau
2013-01-03fix chunked postdata parsingFelix Fietkau
2013-01-03add missing n_clients decrementFelix Fietkau
2013-01-03add post data relayingFelix Fietkau
2013-01-03use a better error code for unsupported expect headersFelix Fietkau
2013-01-03bail out on unsupported Expect: headersFelix Fietkau
2013-01-02fix error handling of invalid http method/versionFelix Fietkau
2013-01-02add support for sending HTTP/1.1 100 ContinueFelix Fietkau
2013-01-02add rfc1918 filter checkFelix Fietkau
2013-01-02add local/remote address env vars for cgiFelix Fietkau
2013-01-02fix client state tracking and request complete handlingFelix Fietkau
2013-01-01add preliminary cgi support, needs fixing for close handlingFelix Fietkau
2013-01-01add uh_split_header()Felix Fietkau
2013-01-01code cleanupFelix Fietkau
2012-12-31free client header buffer memoryFelix Fietkau
2012-12-31move dispatch cbs and data to one placeFelix Fietkau
2012-12-31make uh_path_lookup staticFelix Fietkau
2012-12-31fix 404 and 403 error handling, improve error message outputFelix Fietkau
2012-12-30Initial implementationFelix Fietkau