Skip to content

Commit

Permalink
Improve readability on return handling logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
jalopezsilva authored and sethmlarson committed Nov 8, 2020
1 parent 6fc17a3 commit ce16b21
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/urllib3/util/ssltransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,18 @@ def _decref_socketios(self):
self.socket._decref_socketios()

def _wrap_ssl_read(self, len, buffer=None):
response = None
try:
response = self._ssl_io_loop(self.sslobj.read, len, buffer)
return self._ssl_io_loop(self.sslobj.read, len, buffer)
except ssl.SSLError as e:
if e.errno == ssl.SSL_ERROR_EOF and self.suppress_ragged_eofs:
response = 0 # eof, return 0.
return 0 # eof, return 0.
else:
raise
return response

def _ssl_io_loop(self, func, *args):
""" Performs an I/O loop between incoming/outgoing and the socket."""
should_loop = True
ret = None

while should_loop:
errno = None
Expand Down

0 comments on commit ce16b21

Please sign in to comment.