Upgraded HTTP/2 CONNECT streams cannot be reset, so a failed tunnel looks like a clean close
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- rust
- Lĩnh vực
- backend-api-design, networking
Hướng nghiên cứu
Start with proto::h2::upgrade::pair, H2Upgraded::poll_shutdown, and UpgradedSendStreamTask::tick to trace how shutdown becomes END_STREAM. Then inspect how Upgraded::downcast reaches upgrade implementations. Done means an HTTP/2 CONNECT upgrade can queue CONNECT_ERROR while HTTP/1 upgrades remain unchanged, including the reported tunnel-reset scenario.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem? Please describe.
A server that accepts an HTTP/2 CONNECT (or extended CONNECT) gets the
tunnel from hyper::upgrade::on as an Upgraded. hyper offers no way to end
that stream with an error. Dropping the Upgraded, or shutting it down, always
sends a clean END_STREAM. A proxy whose tunnelled connection fails therefore
cannot tell the client, and the client cannot tell a failed tunnel from a
complete one.
RFC 9113, section 8.5:
A proxy treats any error in the TCP connection, which includes receiving a
TCP segment with the RST bit set, as a stream error (Section 5.4.2) of type
CONNECT_ERROR.
The same applies to a client-side Upgraded whose local end fails.
Versions: hyper 1.9.0. master (1.11.1) has the same code.
Mechanism
proto::h2::upgrade::pairsplits the stream.H2Upgradedkeeps the
RecvStreamand an mpsc sender. TheSendStreammoves into
UpgradedSendStreamTask, which the executor runs.H2Upgraded::poll_shutdowncloses the channel. DroppingH2Upgradeddrops
the sender, which also closes it.UpgradedSendStreamTask::tickanswers a closed channel with
send_data(SendBuf::None, true), which isEND_STREAM.H2Upgradedispub(super)in the privateprotomodule, so
Upgraded::downcastcannot reach it, and theSendStreamis owned by the
task anyway.
So there is no path from user code to SendStream::send_reset.
Reproduction
- Serve HTTP/2 with hyper and accept a
CONNECT; respond200and await
hyper::upgrade::on(req). - Relay the
Upgradedto a TCP connection, and have the remote end of that
TCP connection reset (for exampleSO_LINGER=0then close). - The relay sees
ECONNRESETand drops theUpgraded. - The h2 client's response body ends with
None(END_STREAM), exactly as it
would after a normal FIN. It never sees an error.
Describe the solution you'd like
A small method on Upgraded that queues RST_STREAM(CONNECT_ERROR) for an
HTTP/2 upgrade and returns whether it did, for example
Upgraded::reset_with_connect_error(&mut self) -> bool. It is a no-op that
returns false for an HTTP/1 upgrade. Internally a oneshot carries the reason
to UpgradedSendStreamTask, which checks it before reading the data channel,
so a reset queued just before a drop still wins over the END_STREAM.
Describe alternatives you've considered
A version that takes any error code (h2::Reason is not public in hyper, so a
u32 or a new hyper type) would also work; CONNECT_ERROR is the code the RFC
names for this case. We carry the patch in a vendored copy and can send a PR.
Additional context
We hit this in an HTTP/2 CONNECT tunnel relay (HBONE) and currently carry the change as a patch on a vendored hyper 1.9.0. Happy to open a PR against master.
- Ngôn ngữ chính
- Rust
- Star
- 16.3k
- Fork
- 1.8k
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của hyperium/hyper
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
hyperium/hyper#4206 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Publicly reexport the http crateĐang mởC-feature
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
hyperium/hyper#2652 · 4 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 2 ngày
-
C-feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
hyperium/hyper#4186 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của hyperium/hyper
Issue tương tự
-
Fix large enum variantĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
software-challenge/player_rust#22 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
foundry-rs/foundry#17175 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
state:triage-needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
github/copilot-sdk#2793 ·
Maintainer thường phản hồi trong vòng 1 ngày