Skip to content

Commit

Permalink
🚑 Merge remote-tracking branch 'cameronbrunner/issue-358'
Browse files Browse the repository at this point in the history
This change makes sure that only valid connections are processed.

The `_from_server_socket` routine may return a `None` when the attempt
to establish the connection goes wrong. Like if a client tries to
speak plain text HTTP to HTTPS socket. Earlier, this was causing
`None` to be forwarded to workers to processes making them to exit.
Eventually, there would be no workers left in the pool and the server
would reset any attempts to establish new connections.

Ref #358
  • Loading branch information
webknjaz committed Jan 18, 2021
2 parents 10736ae + 5923b44 commit ff630b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
.. scm-version-title:: v8.5.2

- :issue:`358` via :pr:`359`: Fixed a regression from
:pr:`199` that made the worker threads exit on invalid
connection attempts and could make the whole server
unresponsive once there was no workers left.
-- by :user:`cameronbrunner`.

.. scm-version-title:: v8.5.1

- :cp-issue:`1873` via :pr:`340`: Resurrected an
Expand Down
3 changes: 2 additions & 1 deletion cheroot/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ def _run(self, expiration_interval):
if conn is self.server:
# New connection
new_conn = self._from_server_socket(self.server.socket)
self.server.process_conn(new_conn)
if new_conn is not None:
self.server.process_conn(new_conn)
else:
# unregister connection from the selector until the server
# has read from it and returned it via put()
Expand Down

0 comments on commit ff630b1

Please sign in to comment.