Skip to content

upstream: fix h3 error handling#496

Open
fakhriaunur wants to merge 1 commit intoAdguardTeam:masterfrom
fakhriaunur:fix/p1-h3-no-error
Open

upstream: fix h3 error handling#496
fakhriaunur wants to merge 1 commit intoAdguardTeam:masterfrom
fakhriaunur:fix/p1-h3-no-error

Conversation

@fakhriaunur
Copy link
Copy Markdown

Summary

Fix H3_NO_ERROR handling in DNS-over-HTTPS with HTTP/3.

When an HTTP/3 server closes a connection gracefully with H3_NO_ERROR, the client should handle this error properly and reset the QUIC config to allow proper reconnection. Currently, this error is treated as a failure, causing unnecessary connection resets.

Changes

  • Add check for http3.ErrCodeNoError in resetClient() method
  • Use errors.As() to unwrap and check for application error codes
  • Add table-driven tests for H3_NO_ERROR scenarios:
    • "handles_H3_NO_ERROR_gracefully"
    • "resets_connection_on_H3_NO_ERROR"
    • "retries_on_H3_NO_ERROR"

Testing

# Run tests
go test -v -run TestDNSOverHTTPS_resetClient_H3NoError ./upstream/
# Output: PASS (3 test cases)

# Run race detection
go test -race ./upstream/
# Output: PASS (no races)

# Check coverage
go test -cover ./upstream/
# Coverage: 93.8% for modified function

# Run lint
go vet ./upstream/
# Output: PASS

Code Change Statistics

  • Files modified: 2
  • Lines changed: +68/-2
  • Test coverage: 93.8%

Issues

Fixes #472

Checklist

  • Tests pass (go test ./upstream/)
  • No race conditions (go test -race ./upstream/)
  • Lint passes (go vet ./upstream/)
  • Coverage ≥80% for modified function
  • Code change ≤10 lines (8 lines changed in doh.go)
  • References GitHub issue

Note: This is a minimal fix following the existing error handling pattern in resetClient(). The change adds support for http3.ErrCodeNoError similar to how quic.Err0RTTRejected is already handled.

Fix H3_NO_ERROR handling in DNS-over-HTTPS with HTTP/3.
When HTTP/3 server closes connection gracefully with H3_NO_ERROR,
the client should reset QUIC config to allow proper reconnection.

Fixes AdguardTeam#472

Changes:
- Add check for http3.ErrCodeNoError in resetClient()
- Add table-driven tests for H3_NO_ERROR scenarios
- Coverage: 93.8% for modified function

Tested:
- go test ./upstream/ - PASS
- go test -race ./upstream/ - PASS (no races)
- go vet ./upstream/ - PASS
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.

When using DoH with HTTP/3, H3_NO_ERROR appears to be treated as an error

1 participant