Skip to content

Commit

Permalink
Accept any 2xx response as valid in the client (Fixes miguelgrinberg/…
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Oct 17, 2019
1 parent fdb2202 commit 9d4ab4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions engineio/asyncio_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ async def _connect_polling(self, url, headers, engineio_path):
self._reset()
raise exceptions.ConnectionError(
'Connection refused by the server')
if r.status != 200:
if r.status < 200 or r.status >= 300:
raise exceptions.ConnectionError(
'Unexpected status code {} in server response'.format(
r.status))
Expand Down Expand Up @@ -455,7 +455,7 @@ async def _read_loop_polling(self):
'Connection refused by the server, aborting')
await self.queue.put(None)
break
if r.status != 200:
if r.status < 200 or r.status >= 300:
self.logger.warning('Unexpected status code %s in server '
'response, aborting', r.status)
await self.queue.put(None)
Expand Down Expand Up @@ -563,7 +563,7 @@ async def _write_loop(self):
self.logger.warning(
'Connection refused by the server, aborting')
break
if r.status != 200:
if r.status < 200 or r.status >= 300:
self.logger.warning('Unexpected status code %s in server '
'response, aborting', r.status)
self._reset()
Expand Down
6 changes: 3 additions & 3 deletions engineio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def _connect_polling(self, url, headers, engineio_path):
self._reset()
raise exceptions.ConnectionError(
'Connection refused by the server')
if r.status_code != 200:
if r.status_code < 200 or r.status_code >= 300:
raise exceptions.ConnectionError(
'Unexpected status code {} in server response'.format(
r.status_code))
Expand Down Expand Up @@ -538,7 +538,7 @@ def _read_loop_polling(self):
'Connection refused by the server, aborting')
self.queue.put(None)
break
if r.status_code != 200:
if r.status_code < 200 or r.status_code >= 300:
self.logger.warning('Unexpected status code %s in server '
'response, aborting', r.status_code)
self.queue.put(None)
Expand Down Expand Up @@ -645,7 +645,7 @@ def _write_loop(self):
self.logger.warning(
'Connection refused by the server, aborting')
break
if r.status_code != 200:
if r.status_code < 200 or r.status_code >= 300:
self.logger.warning('Unexpected status code %s in server '
'response, aborting', r.status_code)
self._reset()
Expand Down

0 comments on commit 9d4ab4b

Please sign in to comment.