uclient-http: properly handle HTTP redirects via proxy connections
[oweals/uclient.git] / uclient-http.c
index 8d6d32734ba93286c968212945a66a56fb781257..3168f4c6a58aa372c70587318e5cd80aa4f9c492 100644 (file)
@@ -1174,8 +1174,15 @@ int uclient_http_redirect(struct uclient *cl)
        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;