Skip to content

Add _hnap_post() retry for SB8200 body read failures#310

Merged
itsDNNS merged 2 commits intomainfrom
fix/surfboard-hnap-post-retry-309
Apr 2, 2026
Merged

Add _hnap_post() retry for SB8200 body read failures#310
itsDNNS merged 2 commits intomainfrom
fix/surfboard-hnap-post-retry-309

Conversation

@itsDNNS
Copy link
Copy Markdown
Owner

@itsDNNS itsDNNS commented Apr 2, 2026

Summary

  • Adds a single transport-level retry inside _hnap_post() when the modem resets the TCP connection after sending HTTP 200 headers but before the response body is readable
  • Retry uses a fresh HNAP_AUTH timestamp and reuses the existing session (new TCP connection via Connection: close)
  • Covers all HNAP operations uniformly (login phase 1, phase 2, data fetch) without requiring a full session reset

Context

SB8200 units on firmware AB01.02.053.05 consistently produce ConnectionResetError(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

Refs: #309

itsDNNS added 2 commits April 2, 2026 09:06
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
@itsDNNS itsDNNS merged commit 7f93de4 into main Apr 2, 2026
8 checks passed
@itsDNNS itsDNNS deleted the fix/surfboard-hnap-post-retry-309 branch April 2, 2026 07:17
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.

1 participant