Re: [PATCH 7/9] remote-curl: recognize text/plain with a charset parameter
- From
Jeff King <peff@peff.net>
- Date
- May 22, 2014, 06:05 UTC
- Message-ID
- <20140522060516.GB16587@sigill.intra.peff.net>
- In-Reply-To
- <90CE006F-EE74-40D2-8847-507E37021D84@gmail.com>
On Wed, May 21, 2014 at 05:07:38PM -0700, Kyle J. McKay wrote:
Show 16 quoted lines
> >+ p = skip_prefix(type->buf, "text/plain"); > >+ if (!p || (*p && *p != ';')) > >+ return 0; > >+ > >+ return 1; > >+} > >+ > > I think that a strict reading of RFC 2616 allows "text/plain ; > charset=utf-8" as well as "text/plain;charset=utf-8" and "text/plain; > charset=utf-8". So perhaps this if line instead: > > + if (!p || (*p && *p != ';' && *p != ' ' && *p != '\t')) > > See RFC 2616 section 2.2 for the definition of linear white space (LWS) and > the end of section 2.1 for the "implied *LWS" rule that allows it.
You're right. There are a few exceptions in 3.7:
Linear white space (LWS) MUST NOT be used between the type and subtype, nor between an attribute and its value.
but it does not include between the subtype and parameter. So the "find_parameter" also needs to accept the collapsed whitespace, too, I guess.
-Peff