On Wed, Jan 18 2023, Matthew John Cheetham via GitGitGadget wrote: > From: Matthew John Cheetham <mjcheetham@xxxxxxxxxxx> > + strbuf_add(&buf, ptr, size); > + > + /* Strip the CRLF that should be present at the end of each field */ > + strbuf_trim_trailing_newline(&buf); > + > + /* Start of a new WWW-Authenticate header */ > + if (skip_iprefix(buf.buf, "www-authenticate:", &val)) { > + while (isspace(*val)) > + val++; > + > + strvec_push(values, val); > + http_auth.header_is_last_match = 1; > + goto exit; > [...] > + if (http_auth.header_is_last_match && isspace(*buf.buf)) { > + /* Trim leading whitespace from this continuation hdr line. */ > + strbuf_ltrim(&buf); The mixture of this isspace() loop and then strbuf_ltrim() seems odd, why not stick with the strbuf API? I.e. after skip_iprefix() strbuf_splice() the start of the string away, then use strbuf_ltrim() in the first "if" branch here? Likewise this is open-coding the "isspace" in strbuf_ltrim() for the second "if". Maybe run the strbuf_ltrim() unconditionally, save away the length before, and then: if (http_auth.header_is_last_match && prev_len != buf.len) { ... ?