Commit 0e474d7
committed
Fix HTTP/1 handling of 1xx informational responses
1xx informational responses (100 Continue, 103 Early Hints, etc.) were
treated the same as HEAD and 204/304 responses: Mint emitted `{:done, ref}`
and popped the request from its queue. The real final response arriving
afterwards had no active request and Mint returned `{:unexpected_data, _}`,
closing the connection.
This broke two common scenarios:
* Requests sent with `Expect: 100-continue`, where the server sends 100
Continue before the final response.
* Servers or intermediaries emitting unsolicited 1xx (Plug.Conn.inform/3,
HAProxy 102 Processing, CDNs sending 103 Early Hints, etc.).
Fix: split 1xx out of the `:none` body branch in `message_body/1` into a
new `:informational` body kind. In `decode_body/5`, the `:informational`
clause resets the request's response-side fields (`version`, `status`,
`headers_buffer`, etc.) back to their initial state and continues parsing
from `:status` without popping the request. The `{:status, ref, 1xx}` and
`{:headers, ref, _}` responses are still emitted to the caller by the
existing `:status`/`:headers` decode stages, so informational responses
remain visible; only the premature `{:done, ref}` is suppressed.1 parent 0bfcc86 commit 0e474d7
2 files changed
+103
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
745 | 766 | | |
746 | 767 | | |
747 | 768 | | |
| |||
981 | 1002 | | |
982 | 1003 | | |
983 | 1004 | | |
984 | | - | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
985 | 1009 | | |
986 | 1010 | | |
987 | 1011 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
330 | 408 | | |
331 | 409 | | |
332 | 410 | | |
| |||
0 commit comments