fix for a bug reported by malice.anon@gmail.com (UnicodeEncodeError..self.sock.sendall(str))

This commit is contained in:
Miroslav Stampar 2011-01-28 13:26:20 +00:00
parent b98cbeee04
commit b1c7a17163

View File

@ -71,6 +71,8 @@ EXTRA ATTRIBUTES AND METHODS
"""
from httplib import _CS_REQ_STARTED, _CS_REQ_SENT, _CS_IDLE, CannotSendHeader
from lib.core.common import unicodeToSafeHTMLValue
import threading
import urllib2
import httplib
@ -323,6 +325,9 @@ class HTTPConnection(httplib.HTTPConnection):
else:
raise CannotSendHeader()
for header in self._headers:
self._headers[header] = unicodeToSafeHTMLValue(self._headers[header])
for header in ['Host', 'Accept-Encoding']:
if header in self._headers:
str = '%s: %s' % (header, self._headers[header])