Re: [libmicrohttpd] Cannot set Content-Length in header

2023-11-06 Thread Evgeny Grin
Just to keep it in records. I found at least two applications trying to use the flag MHD_RF_INSANITY_HEADER_CONTENT_LENGTH to set the "Content-Length" header for HEAD responses. This is not a correct approach. Application must provide *correct* response for head request. *Correct* means (in

Re: [libmicrohttpd] Cannot set Content-Length in header

2019-10-29 Thread Christian Grothoff
On 10/29/19 6:36 PM, Tim Rühsen wrote: > Thanks, Christian. > > Tested & it works. > > Not sure why, but I first tested with > MHD_OPTION_SERVER_INSANITY, 1 > when starting the server which doesn't work. Yeah, that one is a server-wide option, which for responses doesn't work as you can have a

Re: [libmicrohttpd] Cannot set Content-Length in header

2019-10-29 Thread Tim Rühsen
Thanks, Christian. Tested & it works. Not sure why, but I first tested with MHD_OPTION_SERVER_INSANITY, 1 when starting the server which doesn't work. Regards, Tim On 25.10.19 14:46, Christian Grothoff wrote: > Hi Tim, > > In Git head, you can now do: > > MHD_set_response_options (response,

Re: [libmicrohttpd] Cannot set Content-Length in header

2019-10-25 Thread Christian Grothoff
Hi Tim, In Git head, you can now do: MHD_set_response_options (response, MHD_RF_INSANITY_HEADER_CONTENT_LENGTH, MHD_RO_END); *before* calling MHD_add_response_header() to get your desired insanity ;-). Test for MHD_VERSION 0x00096702. Happy

Re: [libmicrohttpd] Cannot set Content-Length in header

2019-10-25 Thread Tim Rühsen
Hi Christian, > Alternatively, we could define a bit-field > option SANITY_CHECK to just disable certain sanity checks. WDYT? I like this better since we can have an easy start and slowly evolve it with more flags / bits, as the need arises. Currently, the wget test suite only needs a flag to sw

Re: [libmicrohttpd] Cannot set Content-Length in header

2019-10-25 Thread Christian Grothoff
Hi Tim, I didn't realize this was wget-*testing* related. For your use-case, I agree that having an equivalent of the MHD_OPTION_STRICT_FOR_CLIENT like MHD_OPTION_STRICT_FOR_SERVER where you can set a "-1" to "allow application to break the protocol" could be reasonable. I'd prefer having such a

Re: [libmicrohttpd] Cannot set Content-Length in header

2019-10-25 Thread Tim Rühsen
Hi Christian, for Wget2 we have to test and prepare for all kinds of malicious and misconfigured / misbehaving servers. So what you call a new feature is from our point of view a regression, since it breaks tests. Of course I understand your intention. But maybe we can have both by adding a new o

Re: [libmicrohttpd] Cannot set Content-Length in header

2019-10-24 Thread theantigod
: libmicrohttpd@gnu.org Reply To: libmicrohttpd development and user mailinglist Subject: Re: [libmicrohttpd] Cannot set Content-Length in header Hi! The MHD documentation explicitly says that MHD does NOT allow the application to set the content-length header at all. You're likely ignoring an error

Re: [libmicrohttpd] Cannot set Content-Length in header

2019-10-24 Thread theantigod
istian Grothoff Sent: Thursday, October 24, 2019 14:36 To: libmicrohttpd@gnu.org Reply To: libmicrohttpd development and user mailinglist Subject: Re: [libmicrohttpd] Cannot set Content-Length in header Hi! The MHD documentation explicitly says that MHD does NOT allow the application to set the cont

Re: [libmicrohttpd] Cannot set Content-Length in header

2019-10-24 Thread Christian Grothoff
Hi! The MHD documentation explicitly says that MHD does NOT allow the application to set the content-length header at all. You're likely ignoring an error code you are getting back from the library when trying to set the content-length header. Also, not allowing applications to break the HTTP pro

[libmicrohttpd] Cannot set Content-Length in header

2019-10-24 Thread Archit Pandey
Hello all, I'm working on the test-suite of wget2 that uses libmicrohttpd. I've noticed that on v0.9.66 MHD when I try setting an arbitrary value for Content-Length in the HTTP header, MHD changes it to the correct value. This behavior is not present on 0.9.59. Additionally, I could not find an