summaryrefslogtreecommitdiffstats
path: root/Lib/urllib2.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2011-07-27 01:37:17 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2011-07-27 01:37:17 (GMT)
commit7d7702b5819f2ef262353055f265c7d8d1f39823 (patch)
tree303809f1c5ebfc56e7a3476b543628a5987f6c95 /Lib/urllib2.py
parentd8b1723965ba05d579525c9f09a79d58c18b4a84 (diff)
downloadcpython-7d7702b5819f2ef262353055f265c7d8d1f39823.zip
cpython-7d7702b5819f2ef262353055f265c7d8d1f39823.tar.gz
cpython-7d7702b5819f2ef262353055f265c7d8d1f39823.tar.bz2
merge from 3.2 - fix urlopen behavior on sites which do not send (or obsfuscates) Connection: Close header.
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r--Lib/urllib2.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 2bce745..a0065b5 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -1166,14 +1166,14 @@ class AbstractHTTPHandler(BaseHandler):
try:
h.request(req.get_method(), req.get_selector(), req.data, headers)
+ except socket.error, err: # XXX what error?
+ h.close()
+ raise URLError(err)
+ else:
try:
r = h.getresponse(buffering=True)
- except TypeError: #buffering kw not supported
+ except TypeError: # buffering kw not supported
r = h.getresponse()
- except socket.error, err: # XXX what error?
- raise URLError(err)
- finally:
- h.close()
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.