erlangmochiweb

mochiweb: disable headers ordering


I checked mochiweb response headers, and they are always ordered (descending):

< Server: MochiWeb/1.0 (Any of you quaids got a smint?)
< last-modified: Sun, 30 Aug 2015 23:13:04 GMT
< Date: Sun, 30 Aug 2015 23:15:15 GMT
< Content-Type: text/html
< Content-Length: 89

This looks to be because of mochiweb headers are being handled with an erlang gb_tree, which is later converted to a list so it comes ordered.

Is there a way to change this? as this could resolve in problems (sometimes) like here and here

My problem is that I am trying to create a service that replicates some requests and I am using mochiweb for this, but Headers are being ordered so it isn't completely replicating the response correctly.


Solution

  • Fixed here:

    mochiweb commit 952087e

    It was a problem with formatting the headers in the response, and not in mochiweb_headers.