[Twisted-web] Headers dictionary

glyph at divmod.com glyph at divmod.com
Wed Feb 21 08:54:34 CST 2007


On 01:13 pm, jarek.zgoda at gmail.com wrote:
>Is it only me, or the field names in
>twisted.web.http.Request.received_headers (also returned by
>getAllHeaders()) are case-sensitive?

It's only you.  From twisted.web.http.Request:

    def headerReceived(self, line):
        """Do pre-processing (for content-length) and store this header away.
        """
        header, data = line.split(':', 1)
        header = header.lower()
                        ^^^^^
        # ...
    def getHeader(self, key):
        """Get a header that was sent from the network.
        """
        return self.received_headers.get(key.lower())
                                             ^^^^^

Do you have a more specific example of what's gone wrong?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20070221/c79e64ed/attachment.htm


More information about the Twisted-web mailing list