Commit 4b6ddfc
h2: retry streams reset with REFUSED_STREAM or rejected by GOAWAY (RFC 9113 8.7)
A stream reset with REFUSED_STREAM, or rejected by GOAWAY
(stream_id > last_stream_id), is guaranteed unprocessed by the server and is
safe to retry even for non-idempotent requests (RFC 9113 section 8.7). The
client previously surfaced these as ProtocolError("HTTP/2 stream reset by
peer") / H2GoAwayError after a single attempt, with the RST_STREAM error code
discarded.
- New H2StreamResetError carries the RFC 9113 section 7 error code; the
RSTStreamFrame handler stores it instead of a generic ProtocolError, and
showerror names the code (REFUSED_STREAM, CANCEL, ENHANCE_YOUR_CALM, ...).
- _retryable_request_error classifies REFUSED_STREAM resets and H2GoAwayError
as retryable; _h2_guaranteed_unprocessed lifts the idempotent-method gate
for them (the replayable-body gate still applies).
- The existing _drop_h2_conn! on error already makes the retry use a fresh
connection.
Greens the tests added in the previous commit.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 3fe6184 commit 4b6ddfc
2 files changed
Lines changed: 54 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
41 | 72 | | |
42 | 73 | | |
43 | 74 | | |
| |||
762 | 793 | | |
763 | 794 | | |
764 | 795 | | |
765 | | - | |
| 796 | + | |
766 | 797 | | |
767 | 798 | | |
768 | 799 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| |||
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
75 | 95 | | |
76 | 96 | | |
77 | 97 | | |
| |||
86 | 106 | | |
87 | 107 | | |
88 | 108 | | |
89 | | - | |
| 109 | + | |
| 110 | + | |
90 | 111 | | |
91 | 112 | | |
92 | 113 | | |
| |||
0 commit comments