erlyaws / yaws

Yaws webserver
https://erlyaws.github.io
BSD 3-Clause "New" or "Revised" License
1.28k stars 267 forks source link

Yaws output headers in wrong order #377

Closed leoliu closed 5 years ago

leoliu commented 5 years ago

Try to return the following from a out/1:

out(_A) ->
    [{header, {"Test-Header", "1"}},
     {header, {"Test-Header", "2"}}].

and inspect the response headers in curl or any browser:

Test-Header: 2
Test-Header: 1
vinoski commented 5 years ago

This is an interesting issue, since RFC 7230 clearly states that header order is insignificant, which means we could just close this issue with no changes. However, 7230 also states that it's good practice to return control data headers first, so it certainly suggests an order, and if we're going to do that, there's no reason we can't also do our best to preserve the header order returned from out/1.

leoliu commented 5 years ago

I just tested the fix and it worked well. Thanks.