修正http代理使用GET请求提前return的bug

This commit is contained in:
Mob2003
2023-03-27 14:35:45 +08:00
parent f3881c397a
commit 07a9b5a6f0
5 changed files with 4 additions and 5 deletions
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -348,6 +348,7 @@ func (conn *serverConnect) doConnectTcpWithHttpProxy(network common.NetWork, add
conn.Close("读取http代理结果失败")
return
}
resdata = append(resdata, result[:n]...)
l, _, err := parsereq(req, resdata)
if err != nil {
+3 -5
View File
@@ -199,9 +199,7 @@ func StartHttpProxyWithServer(cfg *common.Addr, n *node, id uint32, pool *httppo
listenId: id,
pool: pool,
}
go handleHttpProxyLocal(s)
}
}()
return l, nil
@@ -236,6 +234,7 @@ func handleHttpProxyLocal(s *httpProxyClient) {
s.Close(err.Error())
return
}
data = append(data, b[:n]...)
//尝试读取一个http消息
l, _, err := parsereq(req, data)
@@ -282,11 +281,10 @@ func handleHttpProxyLocal(s *httpProxyClient) {
buf.WriteString("\r\n")
}
buf.WriteString("\r\n")
s.write2connect(buf.Bytes())
buf.Reset()
bufPool.Put(buf)
return
} else {
return
}
@@ -514,9 +512,9 @@ func parsereq(req *http1request, data []byte) (clen int, resdata []byte, err err
err = fmt.Errorf("%+v", e)
debug.PrintStack()
}
}()
// method, path, proto line
req.Proto = ""