{"thread":{"id":"66196","subject":"[PATCH v2] http: preserve wwwauth_headers across redirects","startedAt":"2026-08-20T03:21:54Z","lastAt":"2026-11-04T18:31:00Z","messageCount":9,"participants":["Aaron Plattner","Junio C Hamano","Jeff King","Matthew John Cheetham","Michal Suchánek"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"550859","messageId":"20260819-http-preserve-wwwauth-redirect-v2-1-4c61039432b0@nvidia.com","threadId":"66196","inReplyTo":null,"subject":"[PATCH v2] http: preserve wwwauth_headers across redirects","fromName":"Aaron Plattner","fromEmail":"aplattner@nvidia.com","sentAt":"2026-08-20T03:21:04Z","receivedAt":"2026-08-20T03:21:54Z","isPatch":true,"sender":{"key":"aplattner@nvidia.com","avatar":"https://avatars.githubusercontent.com/u/343551?v=4"},"body":"When cURL follows a redirect, it calls the CURLOPT_HEADERFUNCTION for\neach header received including ones from a redirect. http_request() sets\nfwrite_wwwauth() as the header function, which will record the wwwauth[]\nentries for the last step in the redirection chain.\n\nHowever, when http_request_recoverable() sees that cURL followed a\nredirect, it attempts to update the credentials for the request from the\nnew URL using credential_from_url(). The first thing that does is call\ncredential_clear(), which clears everything including wwwauth_headers.\n\nIf the new URL should use a credential helper rather than credentials\nembedded in the URL, this loses the list of authentication methods that\nthe server provided in the redirect.\n\nThe WWW-Authenticate challenge is not derived from the URL; it is\npopulated from the server's response, and after a redirect it describes\nhow to authenticate to the redirect target and it needs to survive the\nURL update so that credential helpers can know which authentication\nmethods are allowed.\n\nAdd a new credential_update_url() that wraps credential_from_url() and\npreserves wwwauth_headers specifically. Use SWAP() to avoid having to\ncopy the whole strbuf.\n\nSigned-off-by: Aaron Plattner <aplattner@nvidia.com>\n---\nI decided to come back to this after I noticed that at least one other\nperson had run into the same bug:\n\nhttps://lore.kernel.org/all/CADoNwcscDrx+YcfbcW4YKONDZZQgnPiwEOxL4QYV_C7_=FOFcg@mail.gmail.com/\n\nRather than reworking everything about how credentials are stored, I\ntook your advice in [1] and just moved the code to preserve the wwwauth_headers\ninto credential.c. That way any future credential fields that need to be\npreserved can be added there without having to hunt down other places\nlike http.c that are reaching into it.\n\n[1] https://lore.kernel.org/all/xmqqpl28scll.fsf@gitster.g/\n---\nChanges in v2:\n- Move strvec preservation into a helper function in credential.c\n- Use SWAP instead of strvec_pushv() to avoid having to copy the\n  contents of the strvec.\n- Link to v1: https://patch.msgid.link/20260602161150.1527493-1-aplattner@nvidia.com\n---\n credential.c                | 16 ++++++++++++++++\n credential.h                |  8 ++++++++\n http.c                      |  9 ++++++++-\n t/lib-httpd/apache.conf     |  1 +\n t/t5563-simple-http-auth.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++\n 5 files changed, 78 insertions(+), 1 deletion(-)\n\ndiff --git a/credential.c b/credential.c\nindex 2594c0c422..035399d7ee 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -708,3 +708,19 @@ void credential_from_url(struct credential *c, const char *url)\n \tif (credential_from_url_gently(c, url, 0) < 0)\n \t\tdie(_(\"credential url cannot be parsed: %s\"), url);\n }\n+\n+void credential_update_url(struct credential *c, const char *url)\n+{\n+\tstruct strvec wwwauth_headers = STRVEC_INIT;\n+\n+\t/*\n+\t * credential_from_url() clears the whole credential. Preserve the\n+\t * WWW-Authenticate list, which is derived from the server's original\n+\t * response rather than from the URL and is required to authenticate to\n+\t * the new URL.\n+\t */\n+\tSWAP(wwwauth_headers, c->wwwauth_headers);\n+\tcredential_from_url(c, url);\n+\tSWAP(c->wwwauth_headers, wwwauth_headers);\n+\tstrvec_clear(&wwwauth_headers);\n+}\ndiff --git a/credential.h b/credential.h\nindex c78b72d110..b90f666e33 100644\n--- a/credential.h\n+++ b/credential.h\n@@ -305,6 +305,14 @@ void credential_write(const struct credential *, FILE *,\n void credential_from_url(struct credential *, const char *url);\n int credential_from_url_gently(struct credential *, const char *url, int quiet);\n \n+/*\n+ * Update the URL-derived fields (protocol, host, path) of an existing\n+ * credential to match a new URL. Unlike credential_from_url(), this function\n+ * preserves state that was derived from a server's HTTP redirect response,\n+ * such as the WWW-Authenticate headers.\n+ */\n+void credential_update_url(struct credential *c, const char *url);\n+\n int credential_match(const struct credential *want,\n \t\t     const struct credential *have, int match_password);\n \ndiff --git a/http.c b/http.c\nindex a0d399b274..e8abb9f95a 100644\n--- a/http.c\n+++ b/http.c\n@@ -2427,7 +2427,14 @@ static int http_request_recoverable(const char *url,\n \tif (options->effective_url && options->base_url) {\n \t\tif (update_url_from_redirect(options->base_url,\n \t\t\t\t\t     url, options->effective_url)) {\n-\t\t\tcredential_from_url(&http_auth, options->base_url->buf);\n+\t\t\t/*\n+\t\t\t * Use credential_update_url() rather than\n+\t\t\t * credential_from_url() so that the WWW-Authenticate\n+\t\t\t * challenge the server sent with the redirect target's\n+\t\t\t * response is preserved and handed to the credential\n+\t\t\t * helper.\n+\t\t\t */\n+\t\t\tcredential_update_url(&http_auth, options->base_url->buf);\n \t\t\turl = options->effective_url->buf;\n \t\t}\n \t}\ndiff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf\nindex 4149fc1078..0627ef1433 100644\n--- a/t/lib-httpd/apache.conf\n+++ b/t/lib-httpd/apache.conf\n@@ -203,6 +203,7 @@ RewriteRule ^/dumb-redir/(.*)$ /dumb/$1 [R=301]\n RewriteRule ^/smart-redir-perm/(.*)$ /smart/$1 [R=301]\n RewriteRule ^/smart-redir-temp/(.*)$ /smart/$1 [R=302]\n RewriteRule ^/smart-redir-auth/(.*)$ /auth/smart/$1 [R=301]\n+RewriteRule ^/custom_auth_redir/(.*)$ /custom_auth/$1 [R=302]\n RewriteRule ^/smart-redir-limited/(.*)/info/refs$ /smart/$1/info/refs [R=301]\n RewriteRule ^/ftp-redir/(.*)$ ftp://localhost:1000/$1 [R=302]\n \ndiff --git a/t/t5563-simple-http-auth.sh b/t/t5563-simple-http-auth.sh\nindex a7d475dd68..349ae4ab39 100755\n--- a/t/t5563-simple-http-auth.sh\n+++ b/t/t5563-simple-http-auth.sh\n@@ -557,6 +557,51 @@ test_expect_success 'access using bearer auth' '\n \tEOF\n '\n \n+test_expect_success 'bearer auth after redirect preserves wwwauth headers' '\n+\ttest_when_finished \"per_test_cleanup\" &&\n+\n+\tset_credential_reply get <<-EOF &&\n+\tcapability[]=authtype\n+\tauthtype=Bearer\n+\tcredential=YS1naXQtdG9rZW4=\n+\tEOF\n+\n+\tcat >\"$HTTPD_ROOT_PATH/custom-auth.valid\" <<-EOF &&\n+\tid=1 creds=Bearer YS1naXQtdG9rZW4=\n+\tEOF\n+\n+\tcat >\"$HTTPD_ROOT_PATH/custom-auth.challenge\" <<-EOF &&\n+\tid=1 status=200\n+\tid=default response=WWW-Authenticate: FooBar param1=\"value1\" param2=\"value2\"\n+\tid=default response=WWW-Authenticate: Bearer authorize_uri=\"id.example.com\" p=1 q=0\n+\tid=default response=WWW-Authenticate: Basic realm=\"example.com\"\n+\tEOF\n+\n+\ttest_config_global credential.helper test-helper &&\n+\ttest_config_global credential.useHttpPath true &&\n+\tgit ls-remote \"$HTTPD_URL/custom_auth_redir/repo.git\" &&\n+\n+\texpect_credential_query get <<-EOF &&\n+\tcapability[]=authtype\n+\tcapability[]=state\n+\tprotocol=http\n+\thost=$HTTPD_DEST\n+\tpath=custom_auth/repo.git\n+\twwwauth[]=FooBar param1=\"value1\" param2=\"value2\"\n+\twwwauth[]=Bearer authorize_uri=\"id.example.com\" p=1 q=0\n+\twwwauth[]=Basic realm=\"example.com\"\n+\tEOF\n+\n+\texpect_credential_query store <<-EOF\n+\tcapability[]=authtype\n+\tauthtype=Bearer\n+\tcredential=YS1naXQtdG9rZW4=\n+\tprotocol=http\n+\thost=$HTTPD_DEST\n+\tpath=custom_auth/repo.git\n+\tEOF\n+'\n+\n test_expect_success 'access using bearer auth with invalid credentials' '\n \ttest_when_finished \"per_test_cleanup\" &&\n \n\n---\nbase-commit: dea0ea3582e6980ddbc1173cc8e3e9f9db91cde0\nchange-id: 20260819-http-preserve-wwwauth-redirect-a3fe4dab6b35\n\n"},{"id":"550912","messageId":"xmqq8q60u82x.fsf@gitster.g","threadId":"66196","inReplyTo":"20260819-http-preserve-wwwauth-redirect-v2-1-4c61039432b0@nvidia.com","subject":"Re: [PATCH v2] http: preserve wwwauth_headers across redirects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-08-20T15:26:14Z","receivedAt":"2026-08-20T15:26:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"For those of you who are watching from the sidelines, this v2 lacks\nthe threading history.\n\nThe v1 is at https://lore.kernel.org/git/20260602161150.1527493-1-aplattner@nvidia.com/\n\nThanks.\n\nAaron Plattner <aplattner@nvidia.com> writes:\n\n> When cURL follows a redirect, it calls the CURLOPT_HEADERFUNCTION for\n> each header received including ones from a redirect. http_request() sets\n> fwrite_wwwauth() as the header function, which will record the wwwauth[]\n> entries for the last step in the redirection chain.\n>\n> However, when http_request_recoverable() sees that cURL followed a\n> redirect, it attempts to update the credentials for the request from the\n> new URL using credential_from_url(). The first thing that does is call\n> credential_clear(), which clears everything including wwwauth_headers.\n>\n> If the new URL should use a credential helper rather than credentials\n> embedded in the URL, this loses the list of authentication methods that\n> the server provided in the redirect.\n>\n> The WWW-Authenticate challenge is not derived from the URL; it is\n> populated from the server's response, and after a redirect it describes\n> how to authenticate to the redirect target and it needs to survive the\n> URL update so that credential helpers can know which authentication\n> methods are allowed.\n>\n> Add a new credential_update_url() that wraps credential_from_url() and\n> preserves wwwauth_headers specifically. Use SWAP() to avoid having to\n> copy the whole strbuf.\n>\n> Signed-off-by: Aaron Plattner <aplattner@nvidia.com>\n> ---\n> I decided to come back to this after I noticed that at least one other\n> person had run into the same bug:\n>\n> https://lore.kernel.org/all/CADoNwcscDrx+YcfbcW4YKONDZZQgnPiwEOxL4QYV_C7_=FOFcg@mail.gmail.com/\n>\n> Rather than reworking everything about how credentials are stored, I\n> took your advice in [1] and just moved the code to preserve the wwwauth_headers\n> into credential.c. That way any future credential fields that need to be\n> preserved can be added there without having to hunt down other places\n> like http.c that are reaching into it.\n>\n> [1] https://lore.kernel.org/all/xmqqpl28scll.fsf@gitster.g/\n> ---\n> Changes in v2:\n> - Move strvec preservation into a helper function in credential.c\n> - Use SWAP instead of strvec_pushv() to avoid having to copy the\n>   contents of the strvec.\n> - Link to v1: https://patch.msgid.link/20260602161150.1527493-1-aplattner@nvidia.com\n> ---\n>  credential.c                | 16 ++++++++++++++++\n>  credential.h                |  8 ++++++++\n>  http.c                      |  9 ++++++++-\n>  t/lib-httpd/apache.conf     |  1 +\n>  t/t5563-simple-http-auth.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++\n>  5 files changed, 78 insertions(+), 1 deletion(-)\n>\n> diff --git a/credential.c b/credential.c\n> index 2594c0c422..035399d7ee 100644\n> --- a/credential.c\n> +++ b/credential.c\n> @@ -708,3 +708,19 @@ void credential_from_url(struct credential *c, const char *url)\n>  \tif (credential_from_url_gently(c, url, 0) < 0)\n>  \t\tdie(_(\"credential url cannot be parsed: %s\"), url);\n>  }\n> +\n> +void credential_update_url(struct credential *c, const char *url)\n> +{\n> +\tstruct strvec wwwauth_headers = STRVEC_INIT;\n> +\n> +\t/*\n> +\t * credential_from_url() clears the whole credential. Preserve the\n> +\t * WWW-Authenticate list, which is derived from the server's original\n> +\t * response rather than from the URL and is required to authenticate to\n> +\t * the new URL.\n> +\t */\n> +\tSWAP(wwwauth_headers, c->wwwauth_headers);\n> +\tcredential_from_url(c, url);\n> +\tSWAP(c->wwwauth_headers, wwwauth_headers);\n> +\tstrvec_clear(&wwwauth_headers);\n> +}\n> diff --git a/credential.h b/credential.h\n> index c78b72d110..b90f666e33 100644\n> --- a/credential.h\n> +++ b/credential.h\n> @@ -305,6 +305,14 @@ void credential_write(const struct credential *, FILE *,\n>  void credential_from_url(struct credential *, const char *url);\n>  int credential_from_url_gently(struct credential *, const char *url, int quiet);\n>  \n> +/*\n> + * Update the URL-derived fields (protocol, host, path) of an existing\n> + * credential to match a new URL. Unlike credential_from_url(), this function\n> + * preserves state that was derived from a server's HTTP redirect response,\n> + * such as the WWW-Authenticate headers.\n> + */\n> +void credential_update_url(struct credential *c, const char *url);\n> +\n>  int credential_match(const struct credential *want,\n>  \t\t     const struct credential *have, int match_password);\n>  \n> diff --git a/http.c b/http.c\n> index a0d399b274..e8abb9f95a 100644\n> --- a/http.c\n> +++ b/http.c\n> @@ -2427,7 +2427,14 @@ static int http_request_recoverable(const char *url,\n>  \tif (options->effective_url && options->base_url) {\n>  \t\tif (update_url_from_redirect(options->base_url,\n>  \t\t\t\t\t     url, options->effective_url)) {\n> -\t\t\tcredential_from_url(&http_auth, options->base_url->buf);\n> +\t\t\t/*\n> +\t\t\t * Use credential_update_url() rather than\n> +\t\t\t * credential_from_url() so that the WWW-Authenticate\n> +\t\t\t * challenge the server sent with the redirect target's\n> +\t\t\t * response is preserved and handed to the credential\n> +\t\t\t * helper.\n> +\t\t\t */\n> +\t\t\tcredential_update_url(&http_auth, options->base_url->buf);\n>  \t\t\turl = options->effective_url->buf;\n>  \t\t}\n>  \t}\n> diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf\n> index 4149fc1078..0627ef1433 100644\n> --- a/t/lib-httpd/apache.conf\n> +++ b/t/lib-httpd/apache.conf\n> @@ -203,6 +203,7 @@ RewriteRule ^/dumb-redir/(.*)$ /dumb/$1 [R=301]\n>  RewriteRule ^/smart-redir-perm/(.*)$ /smart/$1 [R=301]\n>  RewriteRule ^/smart-redir-temp/(.*)$ /smart/$1 [R=302]\n>  RewriteRule ^/smart-redir-auth/(.*)$ /auth/smart/$1 [R=301]\n> +RewriteRule ^/custom_auth_redir/(.*)$ /custom_auth/$1 [R=302]\n>  RewriteRule ^/smart-redir-limited/(.*)/info/refs$ /smart/$1/info/refs [R=301]\n>  RewriteRule ^/ftp-redir/(.*)$ ftp://localhost:1000/$1 [R=302]\n>  \n> diff --git a/t/t5563-simple-http-auth.sh b/t/t5563-simple-http-auth.sh\n> index a7d475dd68..349ae4ab39 100755\n> --- a/t/t5563-simple-http-auth.sh\n> +++ b/t/t5563-simple-http-auth.sh\n> @@ -557,6 +557,51 @@ test_expect_success 'access using bearer auth' '\n>  \tEOF\n>  '\n>  \n> +test_expect_success 'bearer auth after redirect preserves wwwauth headers' '\n> +\ttest_when_finished \"per_test_cleanup\" &&\n> +\n> +\tset_credential_reply get <<-EOF &&\n> +\tcapability[]=authtype\n> +\tauthtype=Bearer\n> +\tcredential=YS1naXQtdG9rZW4=\n> +\tEOF\n> +\n> +\tcat >\"$HTTPD_ROOT_PATH/custom-auth.valid\" <<-EOF &&\n> +\tid=1 creds=Bearer YS1naXQtdG9rZW4=\n> +\tEOF\n> +\n> +\tcat >\"$HTTPD_ROOT_PATH/custom-auth.challenge\" <<-EOF &&\n> +\tid=1 status=200\n> +\tid=default response=WWW-Authenticate: FooBar param1=\"value1\" param2=\"value2\"\n> +\tid=default response=WWW-Authenticate: Bearer authorize_uri=\"id.example.com\" p=1 q=0\n> +\tid=default response=WWW-Authenticate: Basic realm=\"example.com\"\n> +\tEOF\n> +\n> +\ttest_config_global credential.helper test-helper &&\n> +\ttest_config_global credential.useHttpPath true &&\n> +\tgit ls-remote \"$HTTPD_URL/custom_auth_redir/repo.git\" &&\n> +\n> +\texpect_credential_query get <<-EOF &&\n> +\tcapability[]=authtype\n> +\tcapability[]=state\n> +\tprotocol=http\n> +\thost=$HTTPD_DEST\n> +\tpath=custom_auth/repo.git\n> +\twwwauth[]=FooBar param1=\"value1\" param2=\"value2\"\n> +\twwwauth[]=Bearer authorize_uri=\"id.example.com\" p=1 q=0\n> +\twwwauth[]=Basic realm=\"example.com\"\n> +\tEOF\n> +\n> +\texpect_credential_query store <<-EOF\n> +\tcapability[]=authtype\n> +\tauthtype=Bearer\n> +\tcredential=YS1naXQtdG9rZW4=\n> +\tprotocol=http\n> +\thost=$HTTPD_DEST\n> +\tpath=custom_auth/repo.git\n> +\tEOF\n> +'\n> +\n>  test_expect_success 'access using bearer auth with invalid credentials' '\n>  \ttest_when_finished \"per_test_cleanup\" &&\n>  \n>\n> ---\n> base-commit: dea0ea3582e6980ddbc1173cc8e3e9f9db91cde0\n> change-id: 20260819-http-preserve-wwwauth-redirect-a3fe4dab6b35\n"},{"id":"551164","messageId":"xmqqbjarowvi.fsf@gitster.g","threadId":"66196","inReplyTo":"xmqq8q60u82x.fsf@gitster.g","subject":"Re: [PATCH v2] http: preserve wwwauth_headers across redirects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-08-25T00:40:49Z","receivedAt":"2026-08-25T00:40:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> For those of you who are watching from the sidelines, this v2 lacks\n> the threading history.\n>\n> The v1 is at https://lore.kernel.org/git/20260602161150.1527493-1-aplattner@nvidia.com/\n\nAny takers?  It should be quite easy to be more interested and be a\nbetter reviewer in the http transfer codepaths than I am.\n\nThanks.\n\n> Aaron Plattner <aplattner@nvidia.com> writes:\n>\n>> When cURL follows a redirect, it calls the CURLOPT_HEADERFUNCTION for\n>> each header received including ones from a redirect. http_request() sets\n>> fwrite_wwwauth() as the header function, which will record the wwwauth[]\n>> entries for the last step in the redirection chain.\n>>\n>> However, when http_request_recoverable() sees that cURL followed a\n>> redirect, it attempts to update the credentials for the request from the\n>> new URL using credential_from_url(). The first thing that does is call\n>> credential_clear(), which clears everything including wwwauth_headers.\n>>\n>> If the new URL should use a credential helper rather than credentials\n>> embedded in the URL, this loses the list of authentication methods that\n>> the server provided in the redirect.\n>>\n>> The WWW-Authenticate challenge is not derived from the URL; it is\n>> populated from the server's response, and after a redirect it describes\n>> how to authenticate to the redirect target and it needs to survive the\n>> URL update so that credential helpers can know which authentication\n>> methods are allowed.\n>>\n>> Add a new credential_update_url() that wraps credential_from_url() and\n>> preserves wwwauth_headers specifically. Use SWAP() to avoid having to\n>> copy the whole strbuf.\n>>\n>> Signed-off-by: Aaron Plattner <aplattner@nvidia.com>\n>> ---\n>> I decided to come back to this after I noticed that at least one other\n>> person had run into the same bug:\n>>\n>> https://lore.kernel.org/all/CADoNwcscDrx+YcfbcW4YKONDZZQgnPiwEOxL4QYV_C7_=FOFcg@mail.gmail.com/\n>>\n>> Rather than reworking everything about how credentials are stored, I\n>> took your advice in [1] and just moved the code to preserve the wwwauth_headers\n>> into credential.c. That way any future credential fields that need to be\n>> preserved can be added there without having to hunt down other places\n>> like http.c that are reaching into it.\n>>\n>> [1] https://lore.kernel.org/all/xmqqpl28scll.fsf@gitster.g/\n>> ---\n>> Changes in v2:\n>> - Move strvec preservation into a helper function in credential.c\n>> - Use SWAP instead of strvec_pushv() to avoid having to copy the\n>>   contents of the strvec.\n>> - Link to v1: https://patch.msgid.link/20260602161150.1527493-1-aplattner@nvidia.com\n>> ---\n>>  credential.c                | 16 ++++++++++++++++\n>>  credential.h                |  8 ++++++++\n>>  http.c                      |  9 ++++++++-\n>>  t/lib-httpd/apache.conf     |  1 +\n>>  t/t5563-simple-http-auth.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++\n>>  5 files changed, 78 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/credential.c b/credential.c\n>> index 2594c0c422..035399d7ee 100644\n>> --- a/credential.c\n>> +++ b/credential.c\n>> @@ -708,3 +708,19 @@ void credential_from_url(struct credential *c, const char *url)\n>>  \tif (credential_from_url_gently(c, url, 0) < 0)\n>>  \t\tdie(_(\"credential url cannot be parsed: %s\"), url);\n>>  }\n>> +\n>> +void credential_update_url(struct credential *c, const char *url)\n>> +{\n>> +\tstruct strvec wwwauth_headers = STRVEC_INIT;\n>> +\n>> +\t/*\n>> +\t * credential_from_url() clears the whole credential. Preserve the\n>> +\t * WWW-Authenticate list, which is derived from the server's original\n>> +\t * response rather than from the URL and is required to authenticate to\n>> +\t * the new URL.\n>> +\t */\n>> +\tSWAP(wwwauth_headers, c->wwwauth_headers);\n>> +\tcredential_from_url(c, url);\n>> +\tSWAP(c->wwwauth_headers, wwwauth_headers);\n>> +\tstrvec_clear(&wwwauth_headers);\n>> +}\n>> diff --git a/credential.h b/credential.h\n>> index c78b72d110..b90f666e33 100644\n>> --- a/credential.h\n>> +++ b/credential.h\n>> @@ -305,6 +305,14 @@ void credential_write(const struct credential *, FILE *,\n>>  void credential_from_url(struct credential *, const char *url);\n>>  int credential_from_url_gently(struct credential *, const char *url, int quiet);\n>>  \n>> +/*\n>> + * Update the URL-derived fields (protocol, host, path) of an existing\n>> + * credential to match a new URL. Unlike credential_from_url(), this function\n>> + * preserves state that was derived from a server's HTTP redirect response,\n>> + * such as the WWW-Authenticate headers.\n>> + */\n>> +void credential_update_url(struct credential *c, const char *url);\n>> +\n>>  int credential_match(const struct credential *want,\n>>  \t\t     const struct credential *have, int match_password);\n>>  \n>> diff --git a/http.c b/http.c\n>> index a0d399b274..e8abb9f95a 100644\n>> --- a/http.c\n>> +++ b/http.c\n>> @@ -2427,7 +2427,14 @@ static int http_request_recoverable(const char *url,\n>>  \tif (options->effective_url && options->base_url) {\n>>  \t\tif (update_url_from_redirect(options->base_url,\n>>  \t\t\t\t\t     url, options->effective_url)) {\n>> -\t\t\tcredential_from_url(&http_auth, options->base_url->buf);\n>> +\t\t\t/*\n>> +\t\t\t * Use credential_update_url() rather than\n>> +\t\t\t * credential_from_url() so that the WWW-Authenticate\n>> +\t\t\t * challenge the server sent with the redirect target's\n>> +\t\t\t * response is preserved and handed to the credential\n>> +\t\t\t * helper.\n>> +\t\t\t */\n>> +\t\t\tcredential_update_url(&http_auth, options->base_url->buf);\n>>  \t\t\turl = options->effective_url->buf;\n>>  \t\t}\n>>  \t}\n>> diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf\n>> index 4149fc1078..0627ef1433 100644\n>> --- a/t/lib-httpd/apache.conf\n>> +++ b/t/lib-httpd/apache.conf\n>> @@ -203,6 +203,7 @@ RewriteRule ^/dumb-redir/(.*)$ /dumb/$1 [R=301]\n>>  RewriteRule ^/smart-redir-perm/(.*)$ /smart/$1 [R=301]\n>>  RewriteRule ^/smart-redir-temp/(.*)$ /smart/$1 [R=302]\n>>  RewriteRule ^/smart-redir-auth/(.*)$ /auth/smart/$1 [R=301]\n>> +RewriteRule ^/custom_auth_redir/(.*)$ /custom_auth/$1 [R=302]\n>>  RewriteRule ^/smart-redir-limited/(.*)/info/refs$ /smart/$1/info/refs [R=301]\n>>  RewriteRule ^/ftp-redir/(.*)$ ftp://localhost:1000/$1 [R=302]\n>>  \n>> diff --git a/t/t5563-simple-http-auth.sh b/t/t5563-simple-http-auth.sh\n>> index a7d475dd68..349ae4ab39 100755\n>> --- a/t/t5563-simple-http-auth.sh\n>> +++ b/t/t5563-simple-http-auth.sh\n>> @@ -557,6 +557,51 @@ test_expect_success 'access using bearer auth' '\n>>  \tEOF\n>>  '\n>>  \n>> +test_expect_success 'bearer auth after redirect preserves wwwauth headers' '\n>> +\ttest_when_finished \"per_test_cleanup\" &&\n>> +\n>> +\tset_credential_reply get <<-EOF &&\n>> +\tcapability[]=authtype\n>> +\tauthtype=Bearer\n>> +\tcredential=YS1naXQtdG9rZW4=\n>> +\tEOF\n>> +\n>> +\tcat >\"$HTTPD_ROOT_PATH/custom-auth.valid\" <<-EOF &&\n>> +\tid=1 creds=Bearer YS1naXQtdG9rZW4=\n>> +\tEOF\n>> +\n>> +\tcat >\"$HTTPD_ROOT_PATH/custom-auth.challenge\" <<-EOF &&\n>> +\tid=1 status=200\n>> +\tid=default response=WWW-Authenticate: FooBar param1=\"value1\" param2=\"value2\"\n>> +\tid=default response=WWW-Authenticate: Bearer authorize_uri=\"id.example.com\" p=1 q=0\n>> +\tid=default response=WWW-Authenticate: Basic realm=\"example.com\"\n>> +\tEOF\n>> +\n>> +\ttest_config_global credential.helper test-helper &&\n>> +\ttest_config_global credential.useHttpPath true &&\n>> +\tgit ls-remote \"$HTTPD_URL/custom_auth_redir/repo.git\" &&\n>> +\n>> +\texpect_credential_query get <<-EOF &&\n>> +\tcapability[]=authtype\n>> +\tcapability[]=state\n>> +\tprotocol=http\n>> +\thost=$HTTPD_DEST\n>> +\tpath=custom_auth/repo.git\n>> +\twwwauth[]=FooBar param1=\"value1\" param2=\"value2\"\n>> +\twwwauth[]=Bearer authorize_uri=\"id.example.com\" p=1 q=0\n>> +\twwwauth[]=Basic realm=\"example.com\"\n>> +\tEOF\n>> +\n>> +\texpect_credential_query store <<-EOF\n>> +\tcapability[]=authtype\n>> +\tauthtype=Bearer\n>> +\tcredential=YS1naXQtdG9rZW4=\n>> +\tprotocol=http\n>> +\thost=$HTTPD_DEST\n>> +\tpath=custom_auth/repo.git\n>> +\tEOF\n>> +'\n>> +\n>>  test_expect_success 'access using bearer auth with invalid credentials' '\n>>  \ttest_when_finished \"per_test_cleanup\" &&\n>>  \n>>\n>> ---\n>> base-commit: dea0ea3582e6980ddbc1173cc8e3e9f9db91cde0\n>> change-id: 20260819-http-preserve-wwwauth-redirect-a3fe4dab6b35\n"},{"id":"557122","messageId":"xmqqwlqvmxa5.fsf@gitster.g","threadId":"66196","inReplyTo":"xmqqbjarowvi.fsf@gitster.g","subject":"Re: [PATCH v2] http: preserve wwwauth_headers across redirects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-11-02T08:51:14Z","receivedAt":"2026-11-02T08:51:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>> For those of you who are watching from the sidelines, this v2 lacks\n>> the threading history.\n>>\n>> The v1 is at https://lore.kernel.org/git/20260602161150.1527493-1-aplattner@nvidia.com/\n>\n> Any takers?  It should be quite easy to be more interested and be a\n> better reviewer in the http transfer codepaths than I am.\n\nSecond call.  Anybody?\n\nUnless we see some volunteers to give it a review in a few weeks, I\nwill discard the topic out of my tree, as 'seen' has been crowded\nwith topics that have been collecting dust without getting many\nreviews.\n\nThanks.\n\n"},{"id":"557402","messageId":"20261104062423.GA1763458@coredump.intra.peff.net","threadId":"66196","inReplyTo":"20260819-http-preserve-wwwauth-redirect-v2-1-4c61039432b0@nvidia.com","subject":"Re: [PATCH v2] http: preserve wwwauth_headers across redirects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2026-11-04T06:24:23Z","receivedAt":"2026-11-04T06:24:23Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 19, 2026 at 08:21:04PM -0700, Aaron Plattner wrote:\n\n> When cURL follows a redirect, it calls the CURLOPT_HEADERFUNCTION for\n> each header received including ones from a redirect. http_request() sets\n> fwrite_wwwauth() as the header function, which will record the wwwauth[]\n> entries for the last step in the redirection chain.\n> \n> However, when http_request_recoverable() sees that cURL followed a\n> redirect, it attempts to update the credentials for the request from the\n> new URL using credential_from_url(). The first thing that does is call\n> credential_clear(), which clears everything including wwwauth_headers.\n> \n> If the new URL should use a credential helper rather than credentials\n> embedded in the URL, this loses the list of authentication methods that\n> the server provided in the redirect.\n\nOK, the problem description makes sense. I think the root cause here is\nthat wwwauth_headers should not really be in the credential struct in\nthe first place. They are a property of the HTTP request, and we get\nthem _back_ from the server; we don't send them. They are stuffed into\nthe credential struct because we pass them to helpers, but they're\notherwise unlike the rest of the struct in that respect.\n\nSo one possible path forward would be to pull them out of the struct,\nthough I think that does create new headaches. We'd need to pass them in\nto credential_fill(), for example, so it can feed them to the helpers.\n\nSo it may be the past of least resistance to just hack around this reset\nproblem and preserve them (i.e., your patch).\n\n> The WWW-Authenticate challenge is not derived from the URL; it is\n> populated from the server's response, and after a redirect it describes\n> how to authenticate to the redirect target and it needs to survive the\n> URL update so that credential helpers can know which authentication\n> methods are allowed.\n> \n> Add a new credential_update_url() that wraps credential_from_url() and\n> preserves wwwauth_headers specifically. Use SWAP() to avoid having to\n> copy the whole strbuf.\n\nSo my biggest question/fear would be: are we creating a security problem\nwherein we use auth information from the original server with the\nredirected-to server (the avoidance of which is the whole point of\nclearing the credential struct in the first place).\n\nAnd I think the answer is \"no\". These wwwauth headers are coming from\nthe server back to us. And as described in 6b8dda9a4f (http: read HTTP\nWWW-Authenticate response headers, 2023-02-27), we get the headers from\n_all_ servers we talk to (the original and the redirect target). So we\nhave to deal with this problem already, and do so by resetting the list\nwhen we see a new HTTP request start. So by definition, the wwwauth\nheaders we get back are the ones from the redirected-to server. And so\npreserving them as we move to that new URL is the correct thing.\n\nI see that the credential_update_url() wrapper is new in this iteration\nof the patch. I actually think it is a slight step in the wrong\ndirection. We know that retaining wwwauth_headers is safe here only\nbecause we know we the updated URL we are feeding matches the response\nfrom that server. Any other hypothetical callers of the new function\nwould also need to consider that (and if they get it wrong, it fails in\nthe insecure direction).\n\nThat said, I'd highly doubt we'd ever get another caller either way (nor\nadd any other data to the credential that is treated this way). So I am\nOK with it, but have a slight preference for the original inline\ntreatment from the v1 patch.\n\n> +void credential_update_url(struct credential *c, const char *url)\n> +{\n> +\tstruct strvec wwwauth_headers = STRVEC_INIT;\n> +\n> +\t/*\n> +\t * credential_from_url() clears the whole credential. Preserve the\n> +\t * WWW-Authenticate list, which is derived from the server's original\n> +\t * response rather than from the URL and is required to authenticate to\n> +\t * the new URL.\n> +\t */\n> +\tSWAP(wwwauth_headers, c->wwwauth_headers);\n> +\tcredential_from_url(c, url);\n> +\tSWAP(c->wwwauth_headers, wwwauth_headers);\n> +\tstrvec_clear(&wwwauth_headers);\n> +}\n\nOK. This strvec_clear() at the end is almost certainly a noop. We\nswapped in the value set by credential_from_url(), which will always be\nblank. But it probably does not hurt. OTOH, if that assumption is wrong,\nwe are throwing away useful bits that we pulled from the URL, without\neven knowing what they are. So maybe:\n\n  if (wwwauth_headers.nr)\n\tBUG(\"credential_from_url put something in the wwwauth_headers?\");\n\nwould better describe what's going on.\n\nI'm adding Matthew Cheetham to the cc, as he was the original author of\nthese wwwauth bits.\n\n-Peff\n\n"},{"id":"557403","messageId":"20261104062701.GB1763458@coredump.intra.peff.net","threadId":"66196","inReplyTo":"xmqqwlqvmxa5.fsf@gitster.g","subject":"Re: [PATCH v2] http: preserve wwwauth_headers across redirects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2026-11-04T06:27:01Z","receivedAt":"2026-11-04T06:27:01Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Nov 02, 2026 at 12:51:14AM -0800, Junio C Hamano wrote:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > Junio C Hamano <gitster@pobox.com> writes:\n> >\n> >> For those of you who are watching from the sidelines, this v2 lacks\n> >> the threading history.\n> >>\n> >> The v1 is at https://lore.kernel.org/git/20260602161150.1527493-1-aplattner@nvidia.com/\n> >\n> > Any takers?  It should be quite easy to be more interested and be a\n> > better reviewer in the http transfer codepaths than I am.\n> \n> Second call.  Anybody?\n> \n> Unless we see some volunteers to give it a review in a few weeks, I\n> will discard the topic out of my tree, as 'seen' has been crowded\n> with topics that have been collecting dust without getting many\n> reviews.\n\nI gave it a review. In short, I think the patch is OK as-is, though I had a\nfew small suggestions for the code (and it might be worth describing the\n\"why is this safe\" part in the commit message).\n\nI think one of the reasons it didn't get much review is that the wwwauth\nis not well understood by other folks who work on HTTP, and the original\nauthor of the feature wasn't cc'd (I did in my review, though he's not\nsuper active these days, so I also wouldn't hold my breath).\n\n-Peff\n\n"},{"id":"557416","messageId":"VI0PR03MB11634E7F7FE122AF61085D7D8C0682@VI0PR03MB11634.eurprd03.prod.outlook.com","threadId":"66196","inReplyTo":"20261104062423.GA1763458@coredump.intra.peff.net","subject":"Re: [PATCH v2] http: preserve wwwauth_headers across redirects","fromName":"Matthew John Cheetham","fromEmail":"mjcheetham@outlook.com","sentAt":"2026-11-04T09:34:17Z","receivedAt":"2026-11-04T09:34:17Z","isPatch":true,"sender":{"key":"mjcheetham@outlook.com","avatar":"https://avatars.githubusercontent.com/u/5658207?v=4"},"body":"On 04/11/2026 06:24, Jeff King wrote:\n\n> On Wed, Aug 19, 2026 at 08:21:04PM -0700, Aaron Plattner wrote:\n> >> When cURL follows a redirect, it calls the CURLOPT_HEADERFUNCTION for\n>> each header received including ones from a redirect. http_request() sets\n>> fwrite_wwwauth() as the header function, which will record the wwwauth[]\n>> entries for the last step in the redirection chain.\n>>\n>> However, when http_request_recoverable() sees that cURL followed a\n>> redirect, it attempts to update the credentials for the request from the\n>> new URL using credential_from_url(). The first thing that does is call\n>> credential_clear(), which clears everything including wwwauth_headers.\n>>\n>> If the new URL should use a credential helper rather than credentials\n>> embedded in the URL, this loses the list of authentication methods that\n>> the server provided in the redirect.\n> > OK, the problem description makes sense. I think the root cause here is\n> that wwwauth_headers should not really be in the credential struct in\n> the first place. They are a property of the HTTP request, and we get\n> them _back_ from the server; we don't send them. They are stuffed into\n> the credential struct because we pass them to helpers, but they're\n> otherwise unlike the rest of the struct in that respect.\n\nYeah, this was one of the awkward parts of passing WWW-Authenticate\nheaders through to credential helpers in the original implementation.\n\nhttp.c has per-request slots, but much of its authentication and\nconfiguration state is global. The credential struct already carried\nhelper configuration and interaction state, such as the helpers list,\nuse_http_path, approved and quit, so it was a convenient place to carry\nthe challenges to helpers too. That does leave URL-derived and\nresponse-derived state with different lifetimes in the same object,\nthough.\n\nI've wondered whether a clearer separation between shared HTTP client\nstate and per-request state would make this easier to reason about.\nThat would also need to account for callers like remote-curl.c and\nhttp-push.c, which configure curl handles through the lower-level slot\nAPI exposed by http.h.\n\nThe current split can make ownership and retries harder to follow, and\nI've certainly contributed some of that complexity myself! ;-)\n\nI've made a few exploratory attempts in that direction: a reusable\nclient with no global state and explicit per-request context and\npolicies for authentication and retries. Nothing ready to propose yet -\nit's a messy space!\n\nThat's a broader cleanup, though, rather than a prerequisite for this\nfix.\n\n> So one possible path forward would be to pull them out of the struct,\n> though I think that does create new headaches. We'd need to pass them in\n> to credential_fill(), for example, so it can feed them to the helpers.\n\nRight, I remember thinking the other alternative would be to expand the\ncredential_fill() function to take headers. Other than the churn, I also\ndidn't do this because WWW-Authenticate headers are an HTTP only\nconstruct, and credential_fill is used for other things like SMTP creds\nand the password to certificates.\n\nYou raised the smell in the original series about adding wwwauth_headers\nand header_is_last_match to the credential struct:\nhttps://lore.kernel.org/git/Y9JWnQeEV0weV4yu@coredump.intra.peff.net\n\nYour follow-up clarified that the main concern was the internal HTTP\nparsing flag. Moving it out would require some extra plumbing across\ncurl callbacks, so we left it as-is at the time:\nhttps://lore.kernel.org/git/Y+TxRDatM9Iirwwu@coredump.intra.peff.net\n\n> So it may be the past of least resistance to just hack around this reset\n> problem and preserve them (i.e., your patch).\n> >> The WWW-Authenticate challenge is not derived from the URL; it is\n>> populated from the server's response, and after a redirect it describes\n>> how to authenticate to the redirect target and it needs to survive the\n>> URL update so that credential helpers can know which authentication\n>> methods are allowed.\n>>\n>> Add a new credential_update_url() that wraps credential_from_url() and\n>> preserves wwwauth_headers specifically. Use SWAP() to avoid having to\n>> copy the whole strbuf.\n> > So my biggest question/fear would be: are we creating a security problem\n> wherein we use auth information from the original server with the\n> redirected-to server (the avoidance of which is the whole point of\n> clearing the credential struct in the first place).\n> > And I think the answer is \"no\". These wwwauth headers are coming from\n> the server back to us. And as described in 6b8dda9a4f (http: read HTTP\n> WWW-Authenticate response headers, 2023-02-27), we get the headers from\n> _all_ servers we talk to (the original and the redirect target). So we\n> have to deal with this problem already, and do so by resetting the list\n> when we see a new HTTP request start. So by definition, the wwwauth\n> headers we get back are the ones from the redirected-to server. And so\n> preserving them as we move to that new URL is the correct thing.\n\nRight. fwrite_wwwauth() clears the challenge list whenever it sees a\nnew HTTP status line. After libcurl follows the redirects, the list\ntherefore belongs to the final response, not an earlier response in\nthe chain. Preserving it while updating the credential context to\nmatch that response's URL is the intended behaviour.\n\n> I see that the credential_update_url() wrapper is new in this iteration\n> of the patch. I actually think it is a slight step in the wrong\n> direction. We know that retaining wwwauth_headers is safe here only\n> because we know we the updated URL we are feeding matches the response\n> from that server. Any other hypothetical callers of the new function\n> would also need to consider that (and if they get it wrong, it fails in\n> the insecure direction).\n> > That said, I'd highly doubt we'd ever get another caller either way (nor\n> add any other data to the credential that is treated this way). So I am\n> OK with it, but have a slight preference for the original inline\n> treatment from the v1 patch.\n> >> +void credential_update_url(struct credential *c, const char *url)\n>> +{\n>> +\tstruct strvec wwwauth_headers = STRVEC_INIT;\n>> +\n>> +\t/*\n>> +\t * credential_from_url() clears the whole credential. Preserve the\n>> +\t * WWW-Authenticate list, which is derived from the server's original\n>> +\t * response rather than from the URL and is required to authenticate to\n>> +\t * the new URL.\n>> +\t */\n>> +\tSWAP(wwwauth_headers, c->wwwauth_headers);\n>> +\tcredential_from_url(c, url);\n>> +\tSWAP(c->wwwauth_headers, wwwauth_headers);\n>> +\tstrvec_clear(&wwwauth_headers);\n>> +}\n> > OK. This strvec_clear() at the end is almost certainly a noop. We\n> swapped in the value set by credential_from_url(), which will always be\n> blank. But it probably does not hurt. OTOH, if that assumption is wrong,\n> we are throwing away useful bits that we pulled from the URL, without\n> even knowing what they are. So maybe:\n> >    if (wwwauth_headers.nr)\n> \tBUG(\"credential_from_url put something in the wwwauth_headers?\");\n> > would better describe what's going on.\n> > I'm adding Matthew Cheetham to the cc, as he was the original author of\n> these wwwauth bits.\n\nI appreciate the cc! :-)\n\n> -Peff\n\n\nThanks,\nMatthew\n\n\n"},{"id":"557444","messageId":"autQ3CB9bD9IIpXp@kunlun.suse.cz","threadId":"66196","inReplyTo":"20261104062423.GA1763458@coredump.intra.peff.net","subject":"Re: [PATCH v2] http: preserve wwwauth_headers across redirects","fromName":"Michal Suchánek","fromEmail":"msuchanek@suse.de","sentAt":"2026-11-04T15:35:56Z","receivedAt":"2026-11-04T15:35:56Z","isPatch":true,"sender":{"key":"msuchanek@suse.de","avatar":"https://avatars.githubusercontent.com/u/787652?v=4"},"body":"Hello,\n\nOn Wed, Nov 04, 2026 at 01:24:23AM -0500, Jeff King wrote:\n> On Wed, Aug 19, 2026 at 08:21:04PM -0700, Aaron Plattner wrote:\n> \n> > When cURL follows a redirect, it calls the CURLOPT_HEADERFUNCTION for\n> > each header received including ones from a redirect. http_request() sets\n> > fwrite_wwwauth() as the header function, which will record the wwwauth[]\n> > entries for the last step in the redirection chain.\n> > \n> > However, when http_request_recoverable() sees that cURL followed a\n> > redirect, it attempts to update the credentials for the request from the\n> > new URL using credential_from_url(). The first thing that does is call\n> > credential_clear(), which clears everything including wwwauth_headers.\n> > \n> > If the new URL should use a credential helper rather than credentials\n> > embedded in the URL, this loses the list of authentication methods that\n> > the server provided in the redirect.\n\nI think the decscription here is inconsistent.\n\nIn the first paragraph it sounds like the wwwauth comes from the\nredirected-to URL, while in the last paragraph it sounds like it comes\nfrom the initial URL.\n\nI think it would be good to word this more clearly.\n\nThanks\n\nMichal\n\n"},{"id":"557487","messageId":"xmqqmrro1maj.fsf@gitster.g","threadId":"66196","inReplyTo":"20261104062701.GB1763458@coredump.intra.peff.net","subject":"Re: [PATCH v2] http: preserve wwwauth_headers across redirects","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-11-04T18:31:00Z","receivedAt":"2026-11-04T18:31:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Nov 02, 2026 at 12:51:14AM -0800, Junio C Hamano wrote:\n>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>> \n>> > Junio C Hamano <gitster@pobox.com> writes:\n>> >\n>> >> For those of you who are watching from the sidelines, this v2 lacks\n>> >> the threading history.\n>> >>\n>> >> The v1 is at https://lore.kernel.org/git/20260602161150.1527493-1-aplattner@nvidia.com/\n>> >\n>> > Any takers?  It should be quite easy to be more interested and be a\n>> > better reviewer in the http transfer codepaths than I am.\n>> \n>> Second call.  Anybody?\n>> \n>> Unless we see some volunteers to give it a review in a few weeks, I\n>> will discard the topic out of my tree, as 'seen' has been crowded\n>> with topics that have been collecting dust without getting many\n>> reviews.\n>\n> I gave it a review. In short, I think the patch is OK as-is, though I had a\n> few small suggestions for the code (and it might be worth describing the\n> \"why is this safe\" part in the commit message).\n>\n> I think one of the reasons it didn't get much review is that the wwwauth\n> is not well understood by other folks who work on HTTP, and the original\n> author of the feature wasn't cc'd (I did in my review, though he's not\n> super active these days, so I also wouldn't hold my breath).\n\nI see there were a few responses to your review.  Let's see how\nAaron responds---perhaps this time we see a small update to move it\nbeyond the finish line ;-).\n\nThanks.\n\n"}]}