From 63b8156c0074552290dc2d50f2743e83bca68e32 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Fri, 25 Feb 2011 09:43:04 +0000 Subject: [PATCH] some update (if header key is non-unicode comformant) --- extra/keepalive/keepalive.py | 8 ++++++-- lib/request/connect.py | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/extra/keepalive/keepalive.py b/extra/keepalive/keepalive.py index 5702559b5..184acea04 100644 --- a/extra/keepalive/keepalive.py +++ b/extra/keepalive/keepalive.py @@ -325,15 +325,19 @@ class HTTPConnection(httplib.HTTPConnection): else: raise CannotSendHeader() + for key, item in self._headers.items(): + del self._headers[key] + self._headers[unicodeToSafeHTMLValue(key)] = unicodeToSafeHTMLValue(item) + for header in ['Host', 'Accept-Encoding']: if header in self._headers: str = '%s: %s' % (header, self._headers[header]) - self._output(unicodeToSafeHTMLValue(str)) + self._output(str) del self._headers[header] for header, value in self._headers.items(): str = '%s: %s' % (header, value) - self._output(unicodeToSafeHTMLValue(str)) + self._output(str) self._send_output() diff --git a/lib/request/connect.py b/lib/request/connect.py index e01c48646..eb14995fc 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -158,7 +158,8 @@ class Connect: headers[key] = item for key, item in headers.items(): - headers[key] = unicodeToSafeHTMLValue(item) + del headers[key] + headers[unicodeToSafeHTMLValue(key)] = unicodeToSafeHTMLValue(item) post = unicodeToSafeHTMLValue(post)