On 01:13 pm, jarek.zgoda@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?
On 2/21/07, glyph@divmod.com <glyph@divmod.com> wrote:
On 01:13 pm, jarek.zgoda@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/
On Wed, 21 Feb 2007 16:15:33 +0100, Jarek Zgoda <jarek.zgoda@gmail.com> wrote:
[snip]
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.
If you use getHeader(name) instead, then the case of name is also irrelevant. Jean-Paul
participants (3)
-
glyph@divmod.com
-
Jarek Zgoda
-
Jean-Paul Calderone