[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] Status 304 and insistent Content-Length header
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] Status 304 and insistent Content-Length header |
Date: |
Wed, 1 Jun 2016 22:03:37 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 |
You're right, my reading of the spec is that we SHOULD NOT transmit
content-length in these cases. Should be fixed in SVN 37227.
(Note that if you explicitly add the header, we do send it, we just no
longer add it in if it is missing in these cases.)
Happy hacking!
Christian
On 06/01/2016 09:29 PM, silvioprog wrote:
> According to links below, the Content-Length should not even be returned in
> 304 responses:
>
> https://trac.nginx.org/nginx/ticket/459
>
> http://stackoverflow.com/questions/691318/what-headers-do-i-want-to-send-together-with-a-304-response
>
> So is there any way to remove the Content-Length from MHD responses?
>
> On Wed, Jun 1, 2016 at 2:20 AM, silvioprog <address@hidden> wrote:
>
>> Hello,
>>
>> In some cases, we need to remove the Content-Length header, for example,
>> when the status code is 304 (not modified), you don't need to send some
>> content-* headers again. See this code:
>>
>> https://github.com/expressjs/express/blob/master/lib/response.js#L192
>>
>> Great, it makes sense, but unfortunatelly MHD always send the
>> Content-Length header, even removing it with:
>>
>> MHD_del_response_header(response, "Content-Length", "3"); // my content is
>> just an "abc" string
>>
>> Is the MHD_del_response_header() function skipping the Content-Length
>> header?
>>
>> Thank you!
>>
>
signature.asc
Description: OpenPGP digital signature