Add _hnap_post() retry for SB8200 body read failures#310
Merged
Conversation
Some SB8200 firmware (AB01.02.053.05) consistently resets the TCP connection after sending HTTP 200 headers but before the response body is readable. The existing retry logic in login() and _try_phase2() only triggers after the error propagates out of _hnap_post(), requiring a full session reset each time. This adds a single retry with fresh HNAP_AUTH directly inside _hnap_post(), catching ConnectionError and ChunkedEncodingError before they reach callers. The retry is lightweight (same session, new connection due to Connection: close) and covers all HNAP operations (login phase 1, phase 2, and data fetch) uniformly. Refs: #309
- Verify ChunkedEncodingError -> ConnectionError preserves cause chain and original error text (not just exception type) - Add phase 2 test proving retry uses derived private key and explicit auth_algo instead of pre-login defaults Refs: #309
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_hnap_post()when the modem resets the TCP connection after sending HTTP 200 headers but before the response body is readableConnection: close)Context
SB8200 units on firmware
AB01.02.053.05consistently produceConnectionResetError(104)during the HTTP response body read. Previous fixes (#304, #306, #308) handled this at the caller level (login(),_try_phase2(),get_docsis_data()), but the error pattern originates in_hnap_post()where a lightweight retry is more effective than a full session reset.Test plan
AB01.02.053.05(tracked in SB8200: login body read fails on old firmware despite legacy TLS #309)Refs: #309