oweals/uclient.git
4 years agouclient-fetch: add option to read POST data from file master
Gio [Fri, 12 Jun 2020 10:59:52 +0000 (12:59 +0200)]
uclient-fetch: add option to read POST data from file

Passing post data in command line is convenient but has limited size,
and may become tricky to correctly escape passed data especially in
scripts.
This patch add the option --post-file so the data to post can be read
from a file.
Tested on x86/64.

Acked-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Gioacchino Mazzurco <gio@eigenlab.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years agouclient-fetch: support specifying advertised TLS ciphers
Jo-Philipp Wich [Sat, 15 Feb 2020 21:39:30 +0000 (22:39 +0100)]
uclient-fetch: support specifying advertised TLS ciphers

Introduce a new `--ciphers` option which allows specifying a colon separated
list of usable TLS ciphers.

Depending on the underlying ustream-ssl provider, the list either follows
OpenSSL's cipher string format or, in case of mbedTLS, is a simple colon
separated cipher whitelist.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
4 years agouclient: Add string error function
Daniel Danzberger [Thu, 5 Dec 2019 16:51:58 +0000 (17:51 +0100)]
uclient: Add string error function

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>
5 years agouclient-http: set data_eof when content-length is 0
Yousong Zhou [Mon, 27 May 2019 02:31:57 +0000 (02:31 +0000)]
uclient-http: set data_eof when content-length is 0

Otherwise uclient-fetch can report "Connection reset prematurely"

Fixes FS#2222

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Acked-by: Petr Štetiar <ynezz@true.cz>
5 years agouclient-http: properly handle HTTP redirects via proxy connections
Jo-Philipp Wich [Sat, 24 Nov 2018 18:54:07 +0000 (19:54 +0100)]
uclient-http: properly handle HTTP redirects via proxy connections

When uclient connects via an HTTP proxy connection we need to swap the
contexts .proxy_url and not the .url property (which is the connection
URL to the proxy server itself).

This fixes uclient erroring out in a redirect loop when connecting via
a proxy connection.

Ref: https://forum.openwrt.org/t/opkg-update-fails/25813
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years agouclient-http: Close ustream file handle only if allocated
Tobias Schramm [Fri, 3 Aug 2018 21:39:21 +0000 (23:39 +0200)]
uclient-http: Close ustream file handle only if allocated

Since the connection setup in uclient_do_connect can fail before
ustream_init_fd is called we must check the fd was actually allocated
before closing it, else we would close STDIN.

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years agouclient-utils: Handle memory allocation failure for url file name
Tobias Schramm [Tue, 20 Feb 2018 10:26:31 +0000 (11:26 +0100)]
uclient-utils: Handle memory allocation failure for url file name

Add null pointer check to allocation of url filename

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years agouclient-http: Implement error handling for header-sending
Tobias Schramm [Tue, 20 Feb 2018 10:26:29 +0000 (11:26 +0100)]
uclient-http: Implement error handling for header-sending

Add some error handling for errors during assembly of headers

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years agouclient: Handle memory allocation failure for url
Tobias Schramm [Sun, 18 Feb 2018 12:46:10 +0000 (13:46 +0100)]
uclient: Handle memory allocation failure for url

Check ptr to url after allocation to prevent null pointer
dereference

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years agouclient-http: Handle memory allocation failure
Tobias Schramm [Sun, 18 Feb 2018 12:46:08 +0000 (13:46 +0100)]
uclient-http: Handle memory allocation failure

Add null pointer check to allocation of uclient_http struct

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years agouclient-http: auth digest: Handle multiple possible memory allocation failures
Tobias Schramm [Sun, 18 Feb 2018 12:46:06 +0000 (13:46 +0100)]
uclient-http: auth digest: Handle multiple possible memory allocation failures

Add null pointer checks to allocation of buffers for authentication parameters

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years agouclient-http: basic auth: Handle memory allocation failure
Tobias Schramm [Sun, 18 Feb 2018 12:46:05 +0000 (13:46 +0100)]
uclient-http: basic auth: Handle memory allocation failure

Allocation of the base64 buffer might fail, resulting in a null
ptr being passed to base64_encode as a target buffer

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years agouclient-fetch: Check for nullpointer returned by uclient_get_url_filename
Tobias Schramm [Sun, 18 Feb 2018 12:46:04 +0000 (13:46 +0100)]
uclient-fetch: Check for nullpointer returned by uclient_get_url_filename

uclient_get_url_filename may return a null ptr resulting in a null
ptr dereference by fprintf and open

Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
6 years agouclient-fetch: use package name pattern in message for missing SSL library
Michael Heimpold [Thu, 25 Jan 2018 20:53:45 +0000 (21:53 +0100)]
uclient-fetch: use package name pattern in message for missing SSL library

When faced with this error message, I did not directly know what
package(s) to install. I first grepped the package list for packages
named libustream-ssl... found nothing, and finally realized, that here
only the library name was mentioned.

But when we mention the certificate packages, why not also directly
mention the SSL/TLS packages with a pattern. That will save one step
next time when stumbling here - at least for me ;-)

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
7 years agouclient-fetch: fix overloading of output_file variable
Felix Fietkau [Thu, 2 Nov 2017 20:58:42 +0000 (21:58 +0100)]
uclient-fetch: fix overloading of output_file variable

When uclient-fetch is called with multiple URL's, it derives the
first filename from the URL. It then sets the global output_file
variable, causing a use-after-free bug on an attempt to use it as output
file for the next file.

Fix this by avoiding the overwrite entirely by only setting a local
variable

Reported-by: Philip Prindeville <philipp@redfish-solutions.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years agouclient-http: fix Host: header for literal IPv6 addresses
Matthias Schiffer [Tue, 5 Sep 2017 18:02:37 +0000 (20:02 +0200)]
uclient-http: fix Host: header for literal IPv6 addresses

For literal IPv6 addresses, the host header must have the form

  Host: [...]

including the square brackets, as it may also contain a port. Some
webservers ignore the missing brackets, while others will return error 400.

IPv6 addresses are determined by searching for ':' characters in the host,
as neither IPv4 addresses nor DNS names can contain colons. An alternative
would be to add a flag to the uclient_url struct; but as this struct is
exposed in public headers, such a change could be considered an ABI change,
making a backport difficult.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Acked-by: Jo-Philipp Wich <jo@mein.io>
7 years agouclient-fetch: read_data_cb: fix a potential buffer overflow
Alexander Couzens [Sun, 11 Jun 2017 11:01:06 +0000 (13:01 +0200)]
uclient-fetch: read_data_cb: fix a potential buffer overflow

When a backend->read() is not implement or returns -1,
This -1 is interpreted as unsigned int resulting
in an access far behind the buffer.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
7 years agoremove obsolete mac os x /opt/local include/library search path
Felix Fietkau [Fri, 9 Dec 2016 12:06:59 +0000 (13:06 +0100)]
remove obsolete mac os x /opt/local include/library search path

Where necessary, this can easily be provided through CFLAGS/LDFLAGS

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years agoFix unused results warnings
Florian Fainelli [Thu, 8 Dec 2016 03:04:45 +0000 (19:04 -0800)]
Fix unused results warnings

Fixes:

uclient-http.c:385:8: error: ignoring return value of 'fread', declared with attribute warn_unused_result [-Werror=unused-result]
   fread(&val, sizeof(val), 1, f);
        ^

uclient-fetch.c: In function 'main':
uclient-fetch.c:664:12: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Werror=unused-result]
    asprintf(&auth_str, "%s:%s", username, password);
            ^
uclient-fetch.c: In function 'read_data_cb':
uclient-fetch.c:269:9: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result]
    write(output_fd, buf, len);

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
7 years agouclient-http: send correct "Host:" header if port is set
Alexander Couzens [Wed, 30 Nov 2016 17:49:10 +0000 (18:49 +0100)]
uclient-http: send correct "Host:" header if port is set

When connecting to a website with a special port, uclient-fetch connects
to the correct port, but is sending an incorrect Host: header without
the corresponding port.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
8 years agoFix printf format in previous commit.
Jo-Philipp Wich [Sat, 30 Jul 2016 13:35:10 +0000 (15:35 +0200)]
Fix printf format in previous commit.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years agoMake missing SSL support message more explicit.
Jo-Philipp Wich [Sat, 30 Jul 2016 13:33:52 +0000 (15:33 +0200)]
Make missing SSL support message more explicit.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years agohttp: add support for relative location on redirect
Felix Fietkau [Tue, 5 Jul 2016 10:39:01 +0000 (12:39 +0200)]
http: add support for relative location on redirect

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years agouclient-fetch: add support for --quiet
Felix Fietkau [Tue, 5 Jul 2016 09:19:38 +0000 (11:19 +0200)]
uclient-fetch: add support for --quiet

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years agocmake: Find libubox/ustream-ssl.h header file
Florian Fainelli [Fri, 1 Jul 2016 23:03:47 +0000 (16:03 -0700)]
cmake: Find libubox/ustream-ssl.h header file

Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for
libubox/ustream-ssl.h.  Some external toolchains which do not include
standard locations would fail to find the header otherwise.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
8 years agohttp: allow sending message body for DELETE request
Rafał Miłecki [Thu, 16 Jun 2016 12:10:05 +0000 (14:10 +0200)]
http: allow sending message body for DELETE request

Sending entity within DELETE is not forbidden by RFC 7231, see section
4.3.5. DELETE:
> A payload within a DELETE request message has no defined semantics;
> sending a payload body on a DELETE request might cause some existing
> implementations to reject the request.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
8 years agouclient-fetch: fix inconsistencies in help text (thx, Hannu Nyman)
Felix Fietkau [Mon, 8 Feb 2016 18:03:57 +0000 (19:03 +0100)]
uclient-fetch: fix inconsistencies in help text (thx, Hannu Nyman)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: use usock_inet_timeout()
Felix Fietkau [Thu, 28 Jan 2016 11:19:54 +0000 (12:19 +0100)]
http: use usock_inet_timeout()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: add support for specifying ipv4/ipv6 preference
Felix Fietkau [Sun, 24 Jan 2016 23:18:33 +0000 (00:18 +0100)]
http: add support for specifying ipv4/ipv6 preference

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: truncate output files (unless resuming)
Felix Fietkau [Sat, 23 Jan 2016 19:59:45 +0000 (20:59 +0100)]
uclient-fetch: truncate output files (unless resuming)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: assume data EOF if the connection terminates
Felix Fietkau [Sat, 23 Jan 2016 18:59:25 +0000 (19:59 +0100)]
http: assume data EOF if the connection terminates

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: fix progress bar initialization with -O-
Felix Fietkau [Sat, 23 Jan 2016 18:52:58 +0000 (19:52 +0100)]
uclient-fetch: fix progress bar initialization with -O-

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: fix processing server http data separated by \n instead of \r\n
Felix Fietkau [Sat, 23 Jan 2016 18:49:55 +0000 (19:49 +0100)]
http: fix processing server http data separated by \n instead of \r\n

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: add proper error handling to uclient_http_redirect()
Felix Fietkau [Sat, 23 Jan 2016 00:23:00 +0000 (01:23 +0100)]
http: add proper error handling to uclient_http_redirect()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: allow overwriting files if -O was used
Felix Fietkau [Thu, 21 Jan 2016 15:58:26 +0000 (16:58 +0100)]
uclient-fetch: allow overwriting files if -O was used

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: fix short command line option for timeout
Felix Fietkau [Wed, 20 Jan 2016 09:52:40 +0000 (10:52 +0100)]
uclient-fetch: fix short command line option for timeout

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: fix connection close handling on auth
Felix Fietkau [Wed, 20 Jan 2016 09:51:58 +0000 (10:51 +0100)]
http: fix connection close handling on auth

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add missing newline after final progress bar update
Felix Fietkau [Tue, 19 Jan 2016 21:59:02 +0000 (22:59 +0100)]
uclient-fetch: add missing newline after final progress bar update

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agocore: fix unused but set variable
Felix Fietkau [Sun, 17 Jan 2016 12:39:51 +0000 (13:39 +0100)]
core: fix unused but set variable

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agocore: make __uclient_get_url static
Felix Fietkau [Sun, 17 Jan 2016 12:39:23 +0000 (13:39 +0100)]
core: make __uclient_get_url static

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add progress bar support
Felix Fietkau [Sun, 17 Jan 2016 12:37:59 +0000 (13:37 +0100)]
uclient-fetch: add progress bar support

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add support for setting output directory
Felix Fietkau [Sat, 16 Jan 2016 22:39:10 +0000 (23:39 +0100)]
uclient-fetch: add support for setting output directory

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-http: use blocking connect, switch to non-blocking later. fixes ipv6 -> ipv4...
Felix Fietkau [Sat, 16 Jan 2016 22:29:51 +0000 (23:29 +0100)]
uclient-http: use blocking connect, switch to non-blocking later. fixes ipv6 -> ipv4 fallback

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: detect connect failure
Felix Fietkau [Sat, 16 Jan 2016 22:26:32 +0000 (23:26 +0100)]
http: detect connect failure

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: ignore SIGPIPE
Felix Fietkau [Sat, 16 Jan 2016 22:25:38 +0000 (23:25 +0100)]
uclient-fetch: ignore SIGPIPE

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add proxy support
Felix Fietkau [Sat, 16 Jan 2016 22:08:55 +0000 (23:08 +0100)]
uclient-fetch: add proxy support

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: add proxy support
Felix Fietkau [Sat, 16 Jan 2016 22:08:46 +0000 (23:08 +0100)]
http: add proxy support

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agocore: add proxy support
Felix Fietkau [Sat, 16 Jan 2016 22:08:31 +0000 (23:08 +0100)]
core: add proxy support

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agocore: fix memory leak if url change fails
Felix Fietkau [Sat, 16 Jan 2016 19:13:36 +0000 (20:13 +0100)]
core: fix memory leak if url change fails

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-http: make username/password variables local
Felix Fietkau [Sat, 16 Jan 2016 18:46:33 +0000 (19:46 +0100)]
uclient-http: make username/password variables local

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add support for resuming downloads
Felix Fietkau [Sat, 16 Jan 2016 18:34:22 +0000 (19:34 +0100)]
uclient-fetch: add support for resuming downloads

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: clean up output file selection
Felix Fietkau [Sat, 16 Jan 2016 18:18:38 +0000 (19:18 +0100)]
uclient-fetch: clean up output file selection

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: allow the header_done callback to reset the client state
Felix Fietkau [Sat, 16 Jan 2016 17:50:22 +0000 (18:50 +0100)]
http: allow the header_done callback to reset the client state

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add support for --timeout
Felix Fietkau [Sat, 16 Jan 2016 12:08:45 +0000 (13:08 +0100)]
uclient-fetch: add support for --timeout

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add support for --spider
Felix Fietkau [Sat, 16 Jan 2016 11:55:36 +0000 (12:55 +0100)]
uclient-fetch: add support for --spider

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add support for --post-data
Felix Fietkau [Sat, 16 Jan 2016 11:50:11 +0000 (12:50 +0100)]
uclient-fetch: add support for --post-data

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: only add default CA entries if no certificate was supplied and verify...
Felix Fietkau [Sat, 16 Jan 2016 11:22:00 +0000 (12:22 +0100)]
uclient-fetch: only add default CA entries if no certificate was supplied and verify was requested

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add support for setting the user agent
Felix Fietkau [Sat, 16 Jan 2016 11:20:09 +0000 (12:20 +0100)]
uclient-fetch: add support for setting the user agent

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add support for fetching multiple urls
Felix Fietkau [Sat, 16 Jan 2016 10:43:40 +0000 (11:43 +0100)]
uclient-fetch: add support for fetching multiple urls

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: add user/password to command line help
Felix Fietkau [Sat, 16 Jan 2016 10:01:58 +0000 (11:01 +0100)]
uclient-fetch: add user/password to command line help

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agouclient-fetch: load CA certificates
Felix Fietkau [Sat, 16 Jan 2016 00:17:33 +0000 (01:17 +0100)]
uclient-fetch: load CA certificates

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
8 years agohttp: get remote address from usock instead of using getpeername
Felix Fietkau [Fri, 15 Jan 2016 20:30:09 +0000 (21:30 +0100)]
http: get remote address from usock instead of using getpeername

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agouclient-fetch: set server_name of the ssl context to support SNI
Alexander Couzens [Thu, 6 Aug 2015 11:02:47 +0000 (13:02 +0200)]
uclient-fetch: set server_name of the ssl context to support SNI

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
9 years agouclient-http: end custom header lines with CRLF
Felix Fietkau [Tue, 14 Apr 2015 21:04:32 +0000 (23:04 +0200)]
uclient-http: end custom header lines with CRLF

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agouclient-http: allow .header_done() callback to reset the connection
Felix Fietkau [Tue, 14 Apr 2015 21:01:53 +0000 (23:01 +0200)]
uclient-http: allow .header_done() callback to reset the connection

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agoallow sending requests with DELETE method
Rafał Miłecki [Thu, 22 Jan 2015 10:45:13 +0000 (11:45 +0100)]
allow sending requests with DELETE method

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
9 years agouse const for char buffer in uclient_write
Rafał Miłecki [Wed, 21 Jan 2015 21:48:35 +0000 (22:48 +0100)]
use const for char buffer in uclient_write

We are not supposed to modify it and ustream accepts const already.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
9 years agosupport for connection timeout
Rafał Miłecki [Fri, 16 Jan 2015 10:21:02 +0000 (11:21 +0100)]
support for connection timeout

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
9 years agohttp: fix processing of digest auth parameters
Felix Fietkau [Fri, 5 Dec 2014 10:56:18 +0000 (11:56 +0100)]
http: fix processing of digest auth parameters

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agohttp: terminate old connection in uclient_http_connect after incomplete request proce...
Felix Fietkau [Thu, 4 Sep 2014 11:19:59 +0000 (13:19 +0200)]
http: terminate old connection in uclient_http_connect after incomplete request processing

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agohttp: do not call uclient_http_disconnect from uclient_notify_eof directly
Felix Fietkau [Thu, 4 Sep 2014 11:10:59 +0000 (13:10 +0200)]
http: do not call uclient_http_disconnect from uclient_notify_eof directly

Depending on the context, it can lead to crashes

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agouclient-http: only invoke data_sent callback if it is provided
Jo-Philipp Wich [Mon, 28 Jul 2014 11:58:02 +0000 (13:58 +0200)]
uclient-http: only invoke data_sent callback if it is provided

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
10 years agohttp: ignore empty lines before HTTP response
Felix Fietkau [Thu, 21 Aug 2014 19:10:30 +0000 (21:10 +0200)]
http: ignore empty lines before HTTP response

Fixes HTTP keepalive issues with some servers

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofetch: fix segfault after destination was not reached
Luka Perkov [Mon, 7 Jul 2014 08:06:24 +0000 (10:06 +0200)]
fetch: fix segfault after destination was not reached

Signed-off-by: Luka Perkov <luka@openwrt.org>
10 years agohttp: implement data_sent write callback
Luka Perkov [Mon, 7 Jul 2014 08:11:41 +0000 (10:11 +0200)]
http: implement data_sent write callback

Signed-off-by: Luka Perkov <luka@openwrt.org>
10 years agohttp: rework authentication handling - only retry internally for GET requests
Felix Fietkau [Wed, 28 May 2014 09:43:56 +0000 (11:43 +0200)]
http: rework authentication handling - only retry internally for GET requests

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agouclient-fetch: define _GNU_SOURCE (used for asprintf)
Felix Fietkau [Fri, 9 May 2014 00:16:51 +0000 (02:16 +0200)]
uclient-fetch: define _GNU_SOURCE (used for asprintf)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofetch: print the URL while connecting
Felix Fietkau [Thu, 8 May 2014 21:20:12 +0000 (23:20 +0200)]
fetch: print the URL while connecting

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofetch: add support for --user and --password
Felix Fietkau [Thu, 8 May 2014 16:51:16 +0000 (18:51 +0200)]
fetch: add support for --user and --password

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofetch: always use O_EXCL when creating output files, use unlink if -O is specified
Felix Fietkau [Thu, 8 May 2014 15:39:51 +0000 (17:39 +0200)]
fetch: always use O_EXCL when creating output files, use unlink if -O is specified

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofetch: print download status
Felix Fietkau [Wed, 7 May 2014 23:26:38 +0000 (01:26 +0200)]
fetch: print download status

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofetch: indicate an error if the connection was terminated prematurely
Felix Fietkau [Wed, 7 May 2014 21:21:52 +0000 (23:21 +0200)]
fetch: indicate an error if the connection was terminated prematurely

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoadd uclient_get_url_filename helper function
Felix Fietkau [Tue, 6 May 2014 13:03:21 +0000 (15:03 +0200)]
add uclient_get_url_filename helper function

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofetch: print error messages on http error codes
Felix Fietkau [Tue, 6 May 2014 12:47:38 +0000 (14:47 +0200)]
fetch: print error messages on http error codes

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofetch: remove http header output
Felix Fietkau [Tue, 6 May 2014 12:46:27 +0000 (14:46 +0200)]
fetch: remove http header output

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agorename uclient-example to uclient-fetch
Felix Fietkau [Tue, 6 May 2014 12:45:12 +0000 (14:45 +0200)]
rename uclient-example to uclient-fetch

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: rename callbacks
Felix Fietkau [Tue, 6 May 2014 12:43:44 +0000 (14:43 +0200)]
example: rename callbacks

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoadd support for PUT requests
Luka Perkov [Mon, 5 May 2014 00:35:11 +0000 (02:35 +0200)]
add support for PUT requests

Signed-off-by: Luka Perkov <luka@openwrt.org>
10 years agoexample: document -q
Felix Fietkau [Sun, 4 May 2014 23:12:57 +0000 (01:12 +0200)]
example: document -q

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: only close output fd after request completion if -O was not used
Felix Fietkau [Sun, 4 May 2014 18:41:22 +0000 (20:41 +0200)]
example: only close output fd after request completion if -O was not used

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: handle uclient connection errors
Felix Fietkau [Sun, 4 May 2014 18:31:02 +0000 (20:31 +0200)]
example: handle uclient connection errors

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: indicate http error presence with return code 8
Felix Fietkau [Sun, 4 May 2014 18:24:18 +0000 (20:24 +0200)]
example: indicate http error presence with return code 8

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: close output file
Felix Fietkau [Sun, 4 May 2014 18:17:47 +0000 (20:17 +0200)]
example: close output file

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: only write output data on http 200/204
Felix Fietkau [Sun, 4 May 2014 18:16:50 +0000 (20:16 +0200)]
example: only write output data on http 200/204

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: document -O
Felix Fietkau [Sun, 4 May 2014 18:00:29 +0000 (20:00 +0200)]
example: document -O

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: always exit on output file errors
Felix Fietkau [Sun, 4 May 2014 17:59:25 +0000 (19:59 +0200)]
example: always exit on output file errors

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoadd uclient_disconnect() to force a disconnect without further callbacks
Felix Fietkau [Sun, 4 May 2014 17:54:22 +0000 (19:54 +0200)]
add uclient_disconnect() to force a disconnect without further callbacks

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: write output data to a file
Felix Fietkau [Sun, 4 May 2014 17:05:02 +0000 (19:05 +0200)]
example: write output data to a file

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: create only one request
Felix Fietkau [Sun, 4 May 2014 16:34:40 +0000 (18:34 +0200)]
example: create only one request

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoexample: update usage info
Felix Fietkau [Sun, 4 May 2014 12:30:18 +0000 (14:30 +0200)]
example: update usage info

Signed-off-by: Felix Fietkau <nbd@openwrt.org>