Re: [PATCH v2 2/6] credential: add WWW-Authenticate header to cred requests
On 10/21/22 1:07 PM, Matthew John Cheetham via GitGitGadget wrote:
Show 18 quoted lines
> From: Matthew John Cheetham <mjcheetham@outlook.com>
>
> Add the value of the WWW-Authenticate response header to credential
> requests. Credential helpers that understand and support HTTP
> authentication and authorization can use this standard header (RFC 2616
> Section 14.47 [1]) to generate valid credentials.
>
> WWW-Authenticate headers can contain information pertaining to the
> authority, authentication mechanism, or extra parameters/scopes that are
> required.
>
> The current I/O format for credential helpers only allows for unique
> names for properties/attributes, so in order to transmit multiple header
> values (with a specific order) we introduce a new convention whereby a
> C-style array syntax is used in the property name to denote multiple
> ordered values for the same property.
>
> In this case we send multiple `wwwauth[n]` properties where `n` is a
> zero-indexed number, reflecting the order the WWW-Authenticate headers
> appeared in the HTTP response.
Here (and maybe in the cover letter) you mention `wwwauth[n]` and `n`...
Show 8 quoted lines
> +`wwwauth[]`::
> +
> + When an HTTP response is received that includes one or more
> + 'WWW-Authenticate' authentication headers, these can be passed to Git
> + (and subsequent credential helpers) with these attributes.
> + Each 'WWW-Authenticate' header value should be passed as a separate
> + attribute 'wwwauth[]' where the order of the attributes is the same
> + as they appear in the HTTP response.
...but here you don't include the `n`.
[...]
Show 5 quoted lines
> +static void credential_write_strvec(FILE *fp, const char *key,
> + const struct strvec *vec)
> +{
> + int i = 0;
> + const char *full_key = xstrfmt("%s[]", key);