summaryrefslogtreecommitdiff
path: root/uclient.c
Commit message (Collapse)AuthorAgeFilesLines
* uclient: cancel state change timeout in uclient_disconnect()HEADmasterMatthias Schiffer2023-04-131-0/+1
| | | | | | | | | | | | | When the uloop is ended right after the state change timeout has been armed, the timeout will never be cancelled, without a way for the libuclient user to clean up. When uclient_free() is then called on the uclient context while the uloop is still live, the entry in uloop's timeout list will be dangling, often resulting in a segfault when new timeouts are added or the timeout list is cleaned up in uloop_done(). Fix this by cancelling the timeout in uclient_disconnect(). Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* uclient: fix initialized but never read variablePetr Štetiar2020-12-111-1/+1
| | | | | | | | | | Fixes following issue reported by clang-12 static analyzer: uclient.c:290:22: warning: Value stored to 'url' during its initialization is never read [deadcode.DeadStores] struct uclient_url *url = cl->url; ^~~ ~~~~~~~ Signed-off-by: Petr Štetiar <ynezz@true.cz>
* Fix extra compiler warningsPetr Štetiar2020-12-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes following -Wextra compiler warnings: uclient.c:195:16: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] for (i = 0; i < ARRAY_SIZE(backends); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~ uclient-http.c:619:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] blobmsg_for_each_attr(cur, uh->headers.head, rem) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-http.c:619:2: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] blobmsg_for_each_attr(cur, uh->headers.head, rem) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-http.c:993:16: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] for (i = 0; i < ARRAY_SIZE(request_types); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ uclient.c:195:16: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] for (i = 0; i < ARRAY_SIZE(backends); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~ uclient-http.c:619:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare] blobmsg_for_each_attr(cur, uh->headers.head, rem) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-http.c:619:2: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] blobmsg_for_each_attr(cur, uh->headers.head, rem) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-http.c:993:16: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare] for (i = 0; i < ARRAY_SIZE(request_types); i++) { ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ uclient-fetch.c:551:67: error: missing field 'flag' initializer [-Werror,-Wmissing-field-initializers] [L_NO_CHECK_CERTIFICATE] = { "no-check-certificate", no_argument }, Signed-off-by: Petr Štetiar <ynezz@true.cz>
* uclient: Add string error functionDaniel Danzberger2019-12-071-0/+20
| | | | | | | This add's the uclient_strerror function, which resolves and error code to a string message. Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
* uclient: Handle memory allocation failure for urlTobias Schramm2018-02-201-0/+3
| | | | | | | Check ptr to url after allocation to prevent null pointer dereference Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
* http: add support for relative location on redirectFelix Fietkau2016-07-051-0/+55
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* core: fix unused but set variableFelix Fietkau2016-01-171-2/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* core: make __uclient_get_url staticFelix Fietkau2016-01-171-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* core: add proxy supportFelix Fietkau2016-01-161-43/+100
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* core: fix memory leak if url change failsFelix Fietkau2016-01-161-1/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* use const for char buffer in uclient_writeRafał Miłecki2015-01-221-1/+1
| | | | | | We are not supposed to modify it and ustream accepts const already. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* support for connection timeoutRafał Miłecki2015-01-181-1/+35
| | | | Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* fetch: indicate an error if the connection was terminated prematurelyFelix Fietkau2014-05-071-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* add uclient_disconnect() to force a disconnect without further callbacksFelix Fietkau2014-05-041-0/+8
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* add support for querying local/remote addressFelix Fietkau2014-04-071-0/+27
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix specifying ports in urlsFelix Fietkau2014-03-291-1/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* add support for passing in auth to uclient_set_url()Felix Fietkau2014-03-291-2/+2
|
* split setting url from connectingFelix Fietkau2014-03-291-14/+17
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* pass auth_str to uclient_new()Felix Fietkau2014-03-261-2/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* add copyright headersFelix Fietkau2014-03-251-0/+17
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* implement optional SSL certificate validation (including CN host check)Felix Fietkau2014-03-251-7/+7
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix prefix id passingFelix Fietkau2014-03-251-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix positioning of the __hidden attributeFelix Fietkau2014-03-231-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* add a utility function to detect redirects and handle themFelix Fietkau2014-03-231-5/+10
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* add missing prototype for uclient_backend_set_errorFelix Fietkau2014-03-221-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* pass the initial / from uclient core to the proto handlerFelix Fietkau2014-03-221-14/+20
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix double / on requests to rootFelix Fietkau2014-03-221-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* add support for reusing connectionsFelix Fietkau2014-03-211-1/+5
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* Initial importFelix Fietkau2014-03-201-0/+200
Signed-off-by: Felix Fietkau <nbd@openwrt.org>