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>
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>
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>
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>
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>
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>