Module Name: src
Committed By: christos
Date: Sun Sep 1 15:07:31 UTC 2024
Modified Files:
src/external/bsd/fetch/dist/libfetch: http.c
Log Message:
PR/58656: RVP: Fix proxy authentication for https and when proxy does not
add any extra headers.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/fetch/dist/libfetch/http.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/fetch/dist/libfetch/http.c
diff -u src/external/bsd/fetch/dist/libfetch/http.c:1.5 src/external/bsd/fetch/dist/libfetch/http.c:1.6
--- src/external/bsd/fetch/dist/libfetch/http.c:1.5 Fri Feb 2 17:19:05 2024
+++ src/external/bsd/fetch/dist/libfetch/http.c Sun Sep 1 11:07:31 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: http.c,v 1.5 2024/02/02 22:19:05 christos Exp $ */
+/* $NetBSD: http.c,v 1.6 2024/09/01 15:07:31 christos Exp $ */
/*-
* Copyright (c) 2000-2004 Dag-Erling Co�dan Sm�rgrav
* Copyright (c) 2003 Thomas Klausner <[email protected]>
@@ -771,16 +771,18 @@ http_connect(struct url *URL, struct url
URL->host, URL->port);
http_cmd(conn, "Host: %s:%d\r\n",
URL->host, URL->port);
+ /* proxy authorization */
+ if (*purl->user || *purl->pwd)
+ http_basic_auth(conn, "Proxy-Authorization",
+ purl->user, purl->pwd);
+ else if ((p = getenv("HTTP_PROXY_AUTH")) != NULL && *p != '\0')
+ http_authorize(conn, "Proxy-Authorization", p);
http_cmd(conn, "\r\n");
if (http_get_reply(conn) != HTTP_OK) {
http_seterr(conn->err);
goto ouch;
}
- /* Read and discard the rest of the proxy response */
- if (fetch_getln(conn) < 0) {
- fetch_syserr();
- goto ouch;
- }
+ /* Read and discard the rest of the proxy response (if any) */
do {
switch ((h = http_next_header(conn, &p))) {
case hdr_syserror:
@@ -792,7 +794,7 @@ http_connect(struct url *URL, struct url
default:
/* ignore */ ;
}
- } while (h < hdr_end);
+ } while (h > hdr_end);
}
if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 &&
fetch_ssl(conn, URL, verbose) == -1) {