git/t/lib-httpd
Aaron Plattner 3de34b072a http: preserve wwwauth_headers across redirects
When cURL follows a redirect, it calls the CURLOPT_HEADERFUNCTION for
each header received including ones from a redirect. http_request() sets
fwrite_wwwauth() as the header function, which will record the wwwauth[]
entries for the last step in the redirection chain.

However, when http_request_recoverable() sees that cURL followed a
redirect, it attempts to update the credentials for the request from the
new URL using credential_from_url(). The first thing that does is call
credential_clear(), which clears everything including wwwauth_headers.

If the new URL should use a credential helper rather than credentials
embedded in the URL, this loses the list of authentication methods that
the server provided in the redirect.

The WWW-Authenticate challenge is not derived from the URL; it is
populated from the server's response, and after a redirect it describes
how to authenticate to the redirect target and it needs to survive the
URL update so that credential helpers can know which authentication
methods are allowed.

Add a new credential_update_url() that wraps credential_from_url() and
preserves wwwauth_headers specifically. Use SWAP() to avoid having to
copy the whole strbuf.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-08-20 07:48:05 -07:00
..
apache.conf http: preserve wwwauth_headers across redirects 2026-08-20 07:48:05 -07:00
apply-one-time-script.sh
broken-smart-http.sh
error-no-report.sh
error-smart-http.sh
error.sh
http-429.sh
incomplete-body-upload-pack-v2-http.sh
incomplete-length-upload-pack-v2-http.sh
nph-custom-auth.sh
passwd
proxy-passwd
ssl.cnf