Repository navigation
HTTP outbound: Fix hanging on server-first traffic - #7193
Merged
Merged
Conversation
Read the first payload with a 500 ms timeout like the VLESS outbound, so protocols where the server speaks first (SMTP, FTP, MySQL) no longer wait forever for client data before CONNECT is sent. Keep tunneled bytes that bufio read together with the CONNECT 200 response instead of dropping them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
|
Core 里的这种等待时间以后得改成 range,比如 500~1000ms,并且再加个随机 padding, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The HTTP outbound waits for the first client payload before it sends CONNECT. With protocols where the server talks first (FTP, SMTP, MySQL, or SSH clients that wait for the server banner, which is probably what #3459 ran into with XShell/MobaXterm) the client waits for the greeting and Xray waits for the client, so the connection hangs until one side gives up.
200, keep tunneled bytes thatbufioalready read together with the response instead of dropping them.v2fly has the same two changes: v2fly/v2ray-core#1517 and the
Buffered()drain in itsconnectHTTP1.Tests (both fail on main):
TestHTTPOutboundServerFirstintesting/scenarios: dokodemo → HTTP outbound → HTTP inbound → a server that sends first.TestHTTP1TunnelKeepsDataReadWithResponseinproxy/http: the proxy writes the200and the greeting in one write.Also tried with real binaries: FTP to vsftpd 3.0.5 through the HTTP outbound, via Xray's HTTP inbound, squid 6.13 and Caddy 2.11.7 forward_proxy, and from a SOCKS inbound with sniffing, times out on main and works with this change. Plain HTTP latency and throughput are unchanged.