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>
if (!url)
return false;
- free(cl->url);
- cl->url = url;
+ if (cl->proxy_url) {
+ free(cl->proxy_url);
+ cl->proxy_url = url;
+ }
+ else {
+ free(cl->url);
+ cl->url = url;
+ }
+
if (uclient_http_connect(cl))
return -1;