diff options
author | Brett Cannon <bcannon@gmail.com> | 2007-02-27 20:16:38 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2007-02-27 20:16:38 (GMT) |
commit | 6f8fe151da16f43fc5d0c5167fc3d9432f993f70 (patch) | |
tree | bb92761a99070583e2d6e66bf8892a41288c7bd1 /Lib/httplib.py | |
parent | 5b198e863941a232093a981a8967083719dcac63 (diff) | |
download | cpython-6f8fe151da16f43fc5d0c5167fc3d9432f993f70.zip cpython-6f8fe151da16f43fc5d0c5167fc3d9432f993f70.tar.gz cpython-6f8fe151da16f43fc5d0c5167fc3d9432f993f70.tar.bz2 |
Fix httplib for removal of slicing from exceptions.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r-- | Lib/httplib.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index 016144c..32889cc 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -870,7 +870,7 @@ class HTTPConnection: self._send_request(method, url, body, headers) except socket.error as v: # trap 'Broken pipe' if we're allowed to automatically reconnect - if v[0] != 32 or not self.auto_open: + if v.message != 32 or not self.auto_open: raise # try one more time self._send_request(method, url, body, headers) @@ -1020,17 +1020,19 @@ class SSLFile(SharedSocketClient): try: buf = self._ssl.read(self._bufsize) except socket.sslerror as err: - if (err[0] == socket.SSL_ERROR_WANT_READ - or err[0] == socket.SSL_ERROR_WANT_WRITE): + err_type = err.message + if (err_type == socket.SSL_ERROR_WANT_READ + or err_type == socket.SSL_ERROR_WANT_WRITE): continue - if (err[0] == socket.SSL_ERROR_ZERO_RETURN - or err[0] == socket.SSL_ERROR_EOF): + if (err_type == socket.SSL_ERROR_ZERO_RETURN + or err_type == socket.SSL_ERROR_EOF): break raise except socket.error as err: - if err[0] == errno.EINTR: + err_type = err.message + if err_type == errno.EINTR: continue - if err[0] == errno.EBADF: + if err_type == errno.EBADF: # XXX socket was closed? break raise |