Re: [PATCH 7/9] remote-curl: recognize text/plain with a charset parameter
- From
Jeff King <peff@peff.net>
- Date
- May 22, 2014, 09:02 UTC
- Message-ID
- <20140522090259.GA29669@sigill.intra.peff.net>
- In-Reply-To
- <21F11C1A-4C69-4633-9DC7-E9134D38856E@gmail.com>
On Thu, May 22, 2014 at 12:27:38AM -0700, Kyle J. McKay wrote:
Show 7 quoted lines
> Yeah I think so too. It's probably enough though just to just strip all " " > and "\t" characters at the same time the content type is lowercased. While > that would cause invalid content types such as "text / plain" to be > recognized it would keep the rest of the code simpler. Since a producer of > an invalid content type shouldn't really be depending on any particular > behavior by a receiver of an invalid content type it's probably not an > issue.
I think you have to retain whitespace between parameters. Not that I expect there to be multiple parameters in a text/plain, but it's allowed.
I started doing this path of trying to produce a normalized version, but found that it was just as much code as parsing at all (and it still leaves the calling code to do its own parse). Instead, what I ended up with was just doing the parsing in http.c into nice, normalized chunks, and then the calling code can compare them with simple strcmps.
I'll post the patches in a few minutes.
-Peff