Skip to content

Commit 427b046

Browse files
committed
SysCallError is treated as SSLError exception
1 parent 412cfdd commit 427b046

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

HISTORY.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
Release History
44
---------------
55

6-
2.4.3.2 (2014-10-24) Rebelmouse
6+
2.4.3.2 (2014-11-06) Rebelmouse
7+
+++++++++++++++++++++++++++++++
8+
- SysCallError is handled as SSLError exception
9+
10+
11+
2.4.3.2 (2014-10-4) Rebelmouse
712
+++++++++++++++++++++++++++++++
813

914
- Raise a requests' exception when occurs 104 - Connection reset by peer

requests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"""
4343

4444
__title__ = 'requests'
45-
__version__ = '2.4.3.2'
45+
__version__ = '2.4.3.3'
4646
__build__ = 0x020403
4747
__author__ = 'Kenneth Reitz'
4848
__license__ = 'Apache 2.0'

requests/packages/urllib3/connectionpool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
from socket import error as SocketError, timeout as SocketTimeout
77
import socket
88

9+
import OpenSSL.SSL
10+
911
try: # Python 3
1012
from queue import LifoQueue, Empty, Full
1113
except ImportError:
@@ -536,7 +538,7 @@ def urlopen(self, method, url, body=None, headers=None, retries=None,
536538
# Timed out by queue.
537539
raise EmptyPoolError(self, "No pool connections are available.")
538540

539-
except (BaseSSLError, CertificateError) as e:
541+
except (BaseSSLError, CertificateError, OpenSSL.SSL.SysCallError) as e:
540542
# Release connection unconditionally because there is no way to
541543
# close it externally in case of exception.
542544
release_conn = True

requests/packages/urllib3/contrib/pyopenssl.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
from .. import connection
6363
from .. import util
6464

65-
from requests import exceptions
6665

6766
__all__ = ['inject_into_urllib3', 'extract_from_urllib3']
6867

@@ -188,8 +187,6 @@ def recv(self, *args, **kwargs):
188187
except OpenSSL.SSL.SysCallError as e:
189188
if self.suppress_ragged_eofs and e.args == (-1, 'Unexpected EOF'):
190189
return b''
191-
elif e.args == (104, 'Connection reset by peer'):
192-
raise exceptions.SSLError('104 Connection reset by peer')
193190
else:
194191
raise
195192
except OpenSSL.SSL.ZeroReturnError:

0 commit comments

Comments
 (0)