important improvement of data handling (POST data and header values)

This commit is contained in:
Miroslav Stampar
2011-04-03 15:02:52 +00:00
parent bbd4c128b0
commit 305115a68b
3 changed files with 24 additions and 26 deletions

View File

@@ -71,7 +71,8 @@ EXTRA ATTRIBUTES AND METHODS
"""
from httplib import _CS_REQ_STARTED, _CS_REQ_SENT, _CS_IDLE, CannotSendHeader
from lib.core.common import unicodeToSafeHTMLValue
from lib.core.common import encodeUnicode
from lib.core.data import kb
import threading
import urllib2
@@ -193,8 +194,6 @@ class HTTPHandler(urllib2.HTTPHandler):
r._host = host
r._url = req.get_full_url()
#if r.status == 200 or not HANDLE_ERRORS:
#return r
if r.status == 200 or not HANDLE_ERRORS:
@@ -316,7 +315,6 @@ class HTTPConnection(httplib.HTTPConnection):
self._headers[header] = value
def endheaders(self):
"""Indicate that the last header line has been sent to the server."""
@@ -325,10 +323,6 @@ 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])
@@ -341,6 +335,9 @@ class HTTPConnection(httplib.HTTPConnection):
self._send_output()
def send(self, str):
httplib.HTTPConnection.send(self, encodeUnicode(str, kb.pageEncoding))
#########################################################################
##### TEST FUNCTIONS
#########################################################################