[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] POST with chunked encoding fails
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] POST with chunked encoding fails |
Date: |
Tue, 18 Dec 2012 21:22:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121027 Icedove/10.0.10 |
On 12/18/2012 08:33 PM, Eivind Sarto wrote:
> I was was having problems receiving data from a client using POST with
> chunked encoding.
> It turns out this client is violating the HTTP spec by setting the
> "Transfer-Encoding: Chunked"
> as well as "Content-Length: 0"
>
> Here are the client headers:
> POST /ee4/live.isml/Streams(Encoder1) HTTP/1.1
> Transfer-Encoding: Chunked
> User-Agent: ExpressionEncoder
> Host: 10.11.1.29
> Content-Length: 0
> Connection: Keep-Alive
> Cache-Control: no-cache
>
> This is what HTTP 1.1 spec says (in section 4.4):
> Messages MUST NOT include both a Content-Length header field and a
> non-identity transfer-coding. If the message does include
> a non- identity transfer-coding, the Content-Length MUST be ignored.
>
> libmicrohttpd does the opposite of what the 4.4 section says if both headers
> are present. It only uses the content-length and ignores the
> chunked encoding.
> I patched libmicrohttpd with the attached patch that does the opposite. It
> ignores the content-length if chunked encoding is also specified.
> And with that patch libmicrohttpd can be a publishing point for MS Expression
> Encoder.
>
> What is your take on this?
This one is easy. We should follow the spec! ;-)
=> in SVN 25536, patched as suggested
(and #MHD_VERSION bumped to 0x91702).
Now, one could possibly convince me that if MHD_USE_PEDANTIC_CHECKS is
set, we should instead generate a hard error. If you want this to be
able to easily test for such bad clients, I'm open for it.
Happy hacking!
Christian