lib/fetch/http.c: fix https->http redirection via proxy.

See https://github.com/void-linux/xbps/issues/52

Thanks @jschultz

Closes: #79 [via git-merge-pr]
This commit is contained in:
Juan RP 2019-04-20 11:31:45 +02:00 committed by Duncaen
parent 0c860d1db0
commit 71775950e8

View File

@ -935,7 +935,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
if (verbose) if (verbose)
fetch_info("requesting %s://%s%s", fetch_info("requesting %s://%s%s",
url->scheme, host, url->doc); url->scheme, host, url->doc);
if (purl && strcasecmp(URL->scheme, SCHEME_HTTPS) != 0) { if (purl && strcasecmp(url->scheme, SCHEME_HTTPS) != 0) {
http_cmd(conn, "%s %s://%s%s HTTP/1.1\r\n", http_cmd(conn, "%s %s://%s%s HTTP/1.1\r\n",
op, url->scheme, host, url->doc); op, url->scheme, host, url->doc);
} else { } else {
@ -949,7 +949,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
/* virtual host */ /* virtual host */
http_cmd(conn, "Host: %s\r\n", host); http_cmd(conn, "Host: %s\r\n", host);
if (strcasecmp(URL->scheme, SCHEME_HTTPS) != 0) if (strcasecmp(url->scheme, SCHEME_HTTPS) != 0)
send_proxy_headers(conn, purl); send_proxy_headers(conn, purl);
/* server authorization */ /* server authorization */