Re: cgi.c POST Content-Type problem

"David Jeske" <[email protected]> Sun, 18 May 2008 18:08:47 -0000
Newsgroups gmane.text.clearsilver.general
Message-ID <[email protected]>
I've seen this same problem. It would be more ideal if we parsed out the
paramaters and made them available. According to RFC2045 they follow the RFC822
rules for structured header fields. For example, these two representations are
both valid:

Content-type: text/plain; charset=us-ascii (comment saying that this is plain
text)
Content-type: text/plain; charset="us-ascii"

http://www.faqs.org/rfcs/rfc2045.html

-- Ogla Sungutay wrote:
> In cgi_parse() there is a string comparison made when we have a POST
> request:
>
> if (type && !strcmp(type, "application/x-www-form-urlencoded"))
> //...
>
> The content type could be something like
> "application/x-www-form-urlencoded; charset:utf-8"
>
> So the condition is not met. As with the later conditional, I use
>
> if (type && !strncmp(type, "application/x-www-form-urlencoded",33))
> , and the problem is gone.