patching and patching and patching

This commit is contained in:
Miroslav Stampar 2010-06-10 17:05:13 +00:00
parent d56cc09fb7
commit 0e1bbf6375

View File

@ -67,7 +67,7 @@ EXTRA ATTRIBUTES AND METHODS
prefer to see your error codes, then do.
"""
from httplib import _CS_REQ_STARTED, _CS_REQ_SENT, CannotSendHeader
from httplib import _CS_REQ_STARTED, _CS_REQ_SENT, _CS_IDLE, CannotSendHeader
import threading
import urllib2
@ -126,16 +126,17 @@ class HTTPHandler(urllib2.HTTPHandler):
h.putheader('Content-length', '%d' % len(data))
else:
h.putrequest('GET', req.get_selector())
except socket.error, err:
raise urllib2.URLError(err)
for args in self.parent.addheaders:
h.putheader(*args)
for k, v in req.headers.items():
h.putheader(k, v)
h.endheaders()
if req.has_data():
h.send(data)
for args in self.parent.addheaders:
h.putheader(*args)
for k, v in req.headers.items():
h.putheader(k, v)
h.endheaders()
if req.has_data():
h.send(data)
except:
h.close()
raise
def do_open(self, http_class, req):
host = req.get_host()