[Twisted-web] Headers dictionary
Jarek Zgoda
jarek.zgoda at gmail.com
Wed Feb 21 09:15:33 CST 2007
On 2/21/07, glyph at divmod.com <glyph at divmod.com> wrote:
> 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?
I explained what gone wrong in my reply to JP. What seems unintuitive
(and is undocumented) is that "lowercase" is treated as synonym for
"case insensitive". Anyway, it's not that bad.
--
Jarek Zgoda
http://jpa.berlios.de/
More information about the Twisted-web
mailing list