Fix SURFboard connection reset on old SB8200 firmware#308
Merged
Conversation
434bc24 to
d760bc1
Compare
SB8200 modems on older firmware reset the TCP connection after sending HTTP 200 headers but before the response body is fully readable. This is caused by the modem's embedded web server tearing down keep-alive connections prematurely. Changes: - Send Connection: close on all HNAP requests unconditionally, not just during legacy TLS. This prevents the modem from attempting keep-alive and ensures the response is fully transmitted before socket teardown. - Handle ConnectionError in get_docsis_data() with session reset and re-authentication, so mid-poll transport failures recover gracefully instead of aborting the entire poll cycle. Refs: #184
d760bc1 to
e7994f5
Compare
This was referenced Apr 2, 2026
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
Connection: closeheader to all HNAP requests, preventing the modem's embedded web server from tearing down keep-alive connections before the response body is fully transmittedConnectionErroringet_docsis_data()with session reset and re-authentication, so mid-poll transport failures recover gracefully instead of aborting the poll cycleThe full fallback chain is: normal HTTPS -> legacy TLS HTTPS -> HTTP.
Context
SB8200 modems on older firmware (e.g.
AB01.02.053.05_051921) exhibit a pattern where the HNAP POST returns HTTP 200 headers, but the modem resets the TCP connection (ConnectionResetError 104) before the response body can be read. This happens consistently on every retry when using persistent HTTP/1.1 connections.Test plan
Refs: #184