libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Response headers order change between 0.9.70 and 0.9


From: Evgeny Grin
Subject: Re: [libmicrohttpd] Response headers order change between 0.9.70 and 0.9.75
Date: Wed, 11 Jan 2023 09:52:46 +0300
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1

Hi Fermín,

MHD internally has two types of response headers: user headers and automatic (mandatory) headers.

For automatic headers MHD now follow RFC recommendation: "...it is good practice to send header fields that contain additional control data first, such as Host on requests and Date on responses" (See RFC9112, 5.3-5). Probably it would make sense to move "Content-Length" and "Transfer-Encoding" headers to the top as well.

For user headers MHD recently fixed the wrong output order. Before the fix, user headers were sent in as reversed sequence relative to the order of headers addition (LIFO). Currently MHD sends user headers exactly in the same order as user added them (FIFO),  with documented exceptions, like special handling of the "Connection" headers. The Changelog entry is here.

However, these changes are mostly cosmetics, as RFC requires "The order in which field lines with differing field names are received in a section is not significant." (here) and "...a sender MUST NOT generate multiple field lines with the same name in a message..." (here). Previous RFC versions have similar requirements. Anyway, for user defined headers you have full control of the header order: the first added header will be sent as the first user header.

Could you share more details about the situation where the order of the headers is important?

--
Wishes,
Evgeny

10.01.2023 20:17, FERMIN GALAN MARQUEZ wrote:

Hi,

 

I’ve recently upgrade from libmicrohttpd 0.9.70 to 0.9.75 in my project (for reference, this one: https://github.com/telefonicaid/fiware-orion).

 

I have observed a curious change of behavior in response headers. In 0.9.70 the server responses like this:

 

HTTP/1.1 400 Bad Request

Content-Length: 129

Content-Type: application/json

Fiware-Correlator: 86753370-9108-11ed-91ea-000c29583ca5

Date: Tue, 10 Jan 2023 17:02:11 GMT

 

But in 0.9.75 response is like this:

 

HTTP/1.1 400 Bad Request

Date: Tue, 10 Jan 2023 17:02:11 GMT

Fiware-Correlator: 86753370-9108-11ed-91ea-000c29583ca5

Content-Type: application/json

Content-Length: 129

 

That is, same headers but in different order.

 

At this point, I have a couple of questions, please:

 

·         Why this has changed between 0.9.70 and 0.9.75? I have tried to find the reason in the changelog at https://github.com/Karlson2k/libmicrohttpd/blob/master/ChangeLog but it is a bit confusing…

·         Is there any way of keeping the older behavior?

 

Any feedback is welcome. Thanks in advance for that!


Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]