TheTorProject/ooni-probe — pull request #298 by QuicksilverJohny (2014-04-04 05:02:06+00:00)
Title: Modified TrueHeaders class to order headers

Fixes [Issue 254](https://github.com/TheTorProject/ooni-probe/issues/254) by storing TrueHeaders in an `OrderedDict`.

Removes clutter from TrueHeaders class by making `_rawHeaders` a simple `OrderedDict` mapping from header string to list of value strings. This conforms with its type in the superclass (`twisted.web.http_headers.Headers`) and removes the need to override a few methods. A new dict `_headerCases` stores the mapping from lowercase header name to their original capitalization. This is accessed by overriding the superclass method `Headers._canonicalNameCaps`.

Adds `test_trueheaders.test_order_preserved` to ensure `getAllRawHeaders` returns headers in the order they were set.