summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* add support for enforcing HTTPSJo-Philipp Wich2015-05-304-1/+78
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* file: disable chunked encoding for file responsesJo-Philipp Wich2015-05-301-0/+1
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* allow request handlers to disable chunked reponsesJo-Philipp Wich2015-05-303-4/+7
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* properly handle return codesJohn Crispin2015-03-281-6/+6
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* fixes for json 0.12John Crispin2015-03-112-5/+5
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* lua: don't make uhttpd_plugin symbol constantJo-Philipp Wich2015-01-251-1/+1
| | | | | | | | uhttpd modifies the list_head member of the uhttpd_plugin struct when loading a plugin, therefore we cannot make it const, otherwise we trigger a security violation if uhttpd is built with RelRO support. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* file: explicitely cast st_mtime to uint64_t when generating ETagJo-Philipp Wich2015-01-251-1/+1
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* ubus: don't make uhttpd_plugin symbol constantJo-Philipp Wich2015-01-251-1/+1
| | | | | | | | uhttpd modifies the list_head member of the uhttpd_plugin struct when loading a plugin, therefore we cannot make it const, otherwise we trigger a security violation if uhttpd is built with RelRO support. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* Build with largefile supportJo-Philipp Wich2015-01-182-6/+5
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* uhttpd: Fix possible memory leaks when generating directory listingAndrej Krpic2014-12-221-3/+4
| | | | | | | | scandir() call requires free() of each returned dirent structure and parent list. Code constructing HTML response of directory listing is missing a call to free in some cases. Signed-off-by: Andrej Krpic <ak77@tnode.com>
* mimetypes: add json and jsonp (distinct from js)Karl Palsson2014-10-271-0/+2
| | | | | | | | | | | | | | .js files are being transferred as text/javascript, which, although obsolete by RFC 4329 is most backward compatible. .json and .jsonp are both transferred as application/octet-stream however, causing warnings on the console for some browsers, even though it works just fine. Add the mimetypes for .json as per RFC 4627 and .jsonp as per RFC4329 (As jsonp _is_ javascript) Signed-off-by: Karl Palsson <karlp@remake.is>
* file: do not emit Content-Length header for 304/412 responsesJo-Philipp Wich2014-10-271-1/+0
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* utils: do not emit eof chunk for 204/304 responsesJo-Philipp Wich2014-10-271-0/+4
| | | | | | | According to RFC2616 10.2.5 and 10.3.5, 204 and 304 responses MUST NOT contain any message body, therfore do not emit an EOF chunk for such responses. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* client: store http code of last emitted responseJo-Philipp Wich2014-10-272-0/+3
| | | | | | | | 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>
* lua: fix error reporting when Lua handler cannot be compiledJo-Philipp Wich2014-09-031-1/+1
| | | | | Reported-by: Sebastian Apel <sebastian.apel@gmx.de> Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* main: use proper variable when warning about unsupported featuresJo-Philipp Wich2014-09-031-3/+3
| | | | | Reported-by: Sebastian Apel <sebastian.apel@gmx.de> Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* file: invoke error handler in 403 case as wellJo-Philipp Wich2014-09-031-0/+14
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* ubus: add CORS header supportJo-Philipp Wich2014-06-105-10/+78
| | | | | | | | | | | | | | | | | | | | | 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>
* cgi: add _GNU_SOURCE define to fix build error on muslFelix Fietkau2014-06-081-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix handling of / as cgi prefixFelix Fietkau2014-04-081-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* main: strdup command line arguments that are modifiedFelix Fietkau2014-03-221-0/+3
| | | | | | This ensures that the process will show the correct command line in ps Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* cgi: compare the physical path instead of the url to detect quirky urlsFelix Fietkau2014-03-223-7/+16
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* relay: do forward data if the http request type was HEADFelix Fietkau2014-03-213-1/+8
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubus: remove indentation and whitespace from JSON responses to conserve a ↵Jo-Philipp Wich2013-11-271-7/+5
| | | | bit of bandwidth
* uhttpd: fix crashes in the ubus pluginFelix Fietkau2013-11-214-1/+39
| | | | | | | | | 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>
* lua: fix lua 5.2 compatibilityFelix Fietkau2013-11-161-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* main: return after processing -d switchJo-Philipp Wich2013-11-111-0/+1
|
* ubus: use "ubus_rpc_session" instead of "sid" attribute name when querying ↵Jo-Philipp Wich2013-09-131-1/+1
| | | | session.access
* ubus: fix session example script to conform to new rpc protocolJo-Philipp Wich2013-09-131-4/+7
|
* ubus: deny requests with a "ubus_rpc_session" toplevel attribute to prevent ↵Jo-Philipp Wich2013-09-131-1/+4
| | | | injecting different SIDs
* ubus: pass current session id as ubus_rpc_session attribute to any called ↵Jo-Philipp Wich2013-08-081-2/+4
| | | | procedure
* ubus: move sid into the params array of the json-rpc request to avoid ↵Jo-Philipp Wich2013-08-072-26/+15
| | | | information leakage via the post url
* ubus: use per-request blob buffer to fetch list results, fixes global buffer ↵Jo-Philipp Wich2013-08-071-19/+29
| | | | corruption with concurrent requests
* client: prevent further read calls after a client has been freedFelix Fietkau2013-07-311-1/+4
| | | | 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>
* detect chrome before safari, chrome includes Safari/ in the UA headerFelix Fietkau2013-07-261-2/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* disable connection_close override if a keep-alive header is foundFelix Fietkau2013-07-261-2/+0
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* disable keep-alive for POST requests to improve compatibilityFelix Fietkau2013-07-261-1/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubus: fix handling of empty JSON-RPC batchesFelix Fietkau2013-06-211-3/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubus: duplicate request buffer to avoid memory corruption with multiple requestsJo-Philipp Wich2013-06-081-4/+9
|
* ubus: use half of the script timeout as timeout for acl lookup callJo-Philipp Wich2013-06-081-1/+1
|
* ubus: implement list method to enumerate objects and signaturesJo-Philipp Wich2013-06-051-19/+109
|
* relay: cancel the timeout on freeFelix Fietkau2013-06-011-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubus: clear the right timeout on rpc connection teardownsFelix Fietkau2013-05-301-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* ubus: fix script timeout unit (seconds, not milliseconds)Felix Fietkau2013-05-301-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* relay: do not process headers after the first errorFelix Fietkau2013-05-232-1/+4
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* relay: fix close handlingFelix Fietkau2013-05-232-5/+13
| | | | | | | | | | 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>
* fix infinite loop when the initial two characters in a connection are \r\nFelix Fietkau2013-05-231-1/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* uhttpd: allow the config to override the default index fileFelix Fietkau2013-05-161-2/+6
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* uhttpd: mark a TLS connections internally to clean up their stateFelix Fietkau2013-05-141-0/+1
| | | | | | Fixes a per-SSL-connection memory leak Signed-off-by: Felix Fietkau <nbd@openwrt.org>