Re: [PATCH v2 4/8] http: extract type/subtype portion of content-type

2014-05-23 Thread Kyle J. McKay
On May 23, 2014, at 13:12, Jeff King wrote: On Thu, May 22, 2014 at 03:52:21PM -0700, Kyle J. McKay wrote: +static void extract_content_type(struct strbuf *raw, struct strbuf *type) +{ + const char *p; + + strbuf_reset(type); + strbuf_grow(type, raw->len); + for (p = r

Re: [PATCH v2 4/8] http: extract type/subtype portion of content-type

2014-05-23 Thread Jeff King
On Thu, May 22, 2014 at 03:52:21PM -0700, Kyle J. McKay wrote: > >+static void extract_content_type(struct strbuf *raw, struct strbuf *type) > >+{ > >+const char *p; > >+ > >+strbuf_reset(type); > >+strbuf_grow(type, raw->len); > >+for (p = raw->buf; *p; p++) { > >+if (

Re: [PATCH v2 4/8] http: extract type/subtype portion of content-type

2014-05-22 Thread Kyle J. McKay
On May 22, 2014, at 02:29, Jeff King wrote: When we get a content-type from curl, we get the whole header line, including any parameters, and without any normalization (like downcasing or whitespace) applied. If we later try to match it with strcmp() or even strcasecmp(), we may get false negat

[PATCH v2 4/8] http: extract type/subtype portion of content-type

2014-05-22 Thread Jeff King
When we get a content-type from curl, we get the whole header line, including any parameters, and without any normalization (like downcasing or whitespace) applied. If we later try to match it with strcmp() or even strcasecmp(), we may get false negatives. This could cause two visible behaviors: