From: Jeff Hostetler Date: Fri, 28 Oct 2022 18:22:15 GMT Subject: Re: [PATCH v2 2/6] credential: add WWW-Authenticate header to cred requests Message-ID: <08de9e0e-af08-2bc3-6693-7bf2b798f20a@jeffhostetler.com> In-Reply-To: <0838d992744a4b06523be6df0edb046ebba033ee.1666372083.git.gitgitgadget@gmail.com> On 10/21/22 1:07 PM, Matthew John Cheetham via GitGitGadget wrote: > From: Matthew John Cheetham > > 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`... > +`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`. [...] > +static void credential_write_strvec(FILE *fp, const char *key, > + const struct strvec *vec) > +{ > + int i = 0; > + const char *full_key = xstrfmt("%s[]", key); ...nor here. Jeff