Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of explict close #467

Merged
merged 1 commit into from
Oct 25, 2023
Merged

Conversation

bdraco
Copy link
Contributor

@bdraco bdraco commented Oct 22, 2023

The check for next_event was not correct for explict closes as https://github.com/python-hyper/h11/blob/a2c68948accadc3876dffcf979d98002e4a4ed27/h11/_connection.py#L445

will only return h11.ConnectionClosed as an object and not a type

The check for next_event was not correct for explict closes as
https://github.com/python-hyper/h11/blob/a2c68948accadc3876dffcf979d98002e4a4ed27/h11/_connection.py#L445

will only return h11.ConnectionClosed as an object and not a type
@codecov
Copy link

codecov bot commented Oct 22, 2023

Codecov Report

Merging #467 (f4315b9) into dev (4398128) will decrease coverage by 0.08%.
The diff coverage is 96.00%.

@@            Coverage Diff             @@
##              dev     #467      +/-   ##
==========================================
- Coverage   92.63%   92.55%   -0.08%     
==========================================
  Files          20       20              
  Lines        2267     2271       +4     
  Branches      279      279              
==========================================
+ Hits         2100     2102       +2     
- Misses        123      124       +1     
- Partials       44       45       +1     
Files Coverage Δ
pyhap/accessory.py 97.33% <100.00%> (ø)
pyhap/hap_server.py 100.00% <100.00%> (ø)
pyhap/hap_protocol.py 98.22% <92.30%> (-1.18%) ⬇️

@@ -246,27 +246,33 @@ def _process_one_event(self) -> bool:
logger.debug(
"%s (%s): h11 Event: %s", self.peername, self.handler.client_uuid, event
)
if event in (h11.NEED_DATA, h11.ConnectionClosed):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bug was missed because there was no explicit test and it looked like it was covered because we did match on NEED_DATA

@bdraco bdraco marked this pull request as ready for review October 22, 2023 19:22
@ikalchev ikalchev merged commit 4c3df6c into ikalchev:dev Oct 25, 2023
9 of 10 checks passed
@bdraco
Copy link
Contributor Author

bdraco commented Oct 25, 2023

Thanks. It would probably be good to get a patch release for this since it can leave around connections otherwise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants