diff --git a/extra/keepalive/keepalive.py b/extra/keepalive/keepalive.py index 129ae6921..ecae85d75 100644 --- a/extra/keepalive/keepalive.py +++ b/extra/keepalive/keepalive.py @@ -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])