mirror of
https://github.com/fatedier/frp.git
synced 2024-12-13 18:21:14 +01:00
plugin: update http_proxy
This commit is contained in:
parent
5db605ca02
commit
1ae43e4d41
@ -66,14 +66,21 @@ func (hp *HttpProxy) Handle(conn io.ReadWriteCloser, realConn frpNet.Conn) {
|
|||||||
wrapConn := frpNet.WrapReadWriteCloserToConn(conn, realConn)
|
wrapConn := frpNet.WrapReadWriteCloserToConn(conn, realConn)
|
||||||
|
|
||||||
sc, rd := frpNet.NewShareConn(wrapConn)
|
sc, rd := frpNet.NewShareConn(wrapConn)
|
||||||
request, err := http.ReadRequest(bufio.NewReader(rd))
|
firstBytes := make([]byte, 7)
|
||||||
|
_, err := rd.Read(firstBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
wrapConn.Close()
|
wrapConn.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if request.Method == http.MethodConnect {
|
if strings.ToUpper(string(firstBytes)) == "CONNECT" {
|
||||||
hp.handleConnectReq(request, frpIo.WrapReadWriteCloser(rd, wrapConn, nil))
|
bufRd := bufio.NewReader(sc)
|
||||||
|
request, err := http.ReadRequest(bufRd)
|
||||||
|
if err != nil {
|
||||||
|
wrapConn.Close()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hp.handleConnectReq(request, frpIo.WrapReadWriteCloser(bufRd, wrapConn, wrapConn.Close))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user