mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-12-17 20:54:36 +03:00
Socks/HTTP inbound: Fix unexpected rawConn copy (#5041)
Fixes https://github.com/XTLS/Xray-core/issues/5040
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/xtls/xray-core/core"
|
||||
"github.com/xtls/xray-core/features/policy"
|
||||
"github.com/xtls/xray-core/features/routing"
|
||||
"github.com/xtls/xray-core/proxy"
|
||||
"github.com/xtls/xray-core/transport/internet/stat"
|
||||
)
|
||||
|
||||
@@ -95,6 +96,9 @@ func (s *Server) ProcessWithFirstbyte(ctx context.Context, network net.Network,
|
||||
inbound.User = &protocol.MemoryUser{
|
||||
Level: s.config.UserLevel,
|
||||
}
|
||||
if !proxy.IsRAWTransport(conn) {
|
||||
inbound.CanSpliceCopy = 3
|
||||
}
|
||||
var reader *bufio.Reader
|
||||
if len(firstbyte) > 0 {
|
||||
readerWithoutFirstbyte := bufio.NewReaderSize(readerOnly{conn}, buf.Size)
|
||||
@@ -207,7 +211,9 @@ func (s *Server) handleConnect(ctx context.Context, _ *http.Request, reader *buf
|
||||
}
|
||||
|
||||
responseDone := func() error {
|
||||
inbound.CanSpliceCopy = 1
|
||||
if inbound.CanSpliceCopy == 2 {
|
||||
inbound.CanSpliceCopy = 1
|
||||
}
|
||||
defer timer.SetTimeout(plcy.Timeouts.UplinkOnly)
|
||||
|
||||
v2writer := buf.NewWriter(conn)
|
||||
|
||||
Reference in New Issue
Block a user