mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-11-06 02:07:17 +00:00
HTTP inbound: Forward short 100 Continue responses promptly (#7298)
https://github.com/XTLS/Xray-core/pull/7298#issuecomment-6542585254 --------- Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
This commit is contained in:
@@ -312,8 +312,9 @@ func (s *Server) handlePlainHTTP(ctx context.Context, request *http.Request, wri
|
||||
// Sometimes, server might send 1xx response to client
|
||||
// it should not be processed by http proxy handler, just forward it to client
|
||||
func readResponseAndHandle100Continue(r *bufio.Reader, req *http.Request, writer io.Writer) (*http.Response, error) {
|
||||
// have a little look of response
|
||||
peekBytes, err := r.Peek(56)
|
||||
// Wait for the HTTP/1.x status prefix before inspecting the buffered response.
|
||||
r.Peek(12)
|
||||
peekBytes, err := r.Peek(min(56, r.Buffered()))
|
||||
if err == nil || err == bufio.ErrBufferFull {
|
||||
str := string(peekBytes)
|
||||
ResponseLine := strings.Split(str, "\r\n")[0]
|
||||
|
||||
Reference in New Issue
Block a user