修正http代理使用GET请求提前return的bug
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -348,6 +348,7 @@ func (conn *serverConnect) doConnectTcpWithHttpProxy(network common.NetWork, add
|
|||||||
conn.Close("读取http代理结果失败")
|
conn.Close("读取http代理结果失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resdata = append(resdata, result[:n]...)
|
resdata = append(resdata, result[:n]...)
|
||||||
l, _, err := parsereq(req, resdata)
|
l, _, err := parsereq(req, resdata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -199,9 +199,7 @@ func StartHttpProxyWithServer(cfg *common.Addr, n *node, id uint32, pool *httppo
|
|||||||
listenId: id,
|
listenId: id,
|
||||||
pool: pool,
|
pool: pool,
|
||||||
}
|
}
|
||||||
|
|
||||||
go handleHttpProxyLocal(s)
|
go handleHttpProxyLocal(s)
|
||||||
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
return l, nil
|
return l, nil
|
||||||
@@ -236,6 +234,7 @@ func handleHttpProxyLocal(s *httpProxyClient) {
|
|||||||
s.Close(err.Error())
|
s.Close(err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data = append(data, b[:n]...)
|
data = append(data, b[:n]...)
|
||||||
//尝试读取一个http消息
|
//尝试读取一个http消息
|
||||||
l, _, err := parsereq(req, data)
|
l, _, err := parsereq(req, data)
|
||||||
@@ -282,11 +281,10 @@ func handleHttpProxyLocal(s *httpProxyClient) {
|
|||||||
buf.WriteString("\r\n")
|
buf.WriteString("\r\n")
|
||||||
}
|
}
|
||||||
buf.WriteString("\r\n")
|
buf.WriteString("\r\n")
|
||||||
|
|
||||||
s.write2connect(buf.Bytes())
|
s.write2connect(buf.Bytes())
|
||||||
buf.Reset()
|
buf.Reset()
|
||||||
bufPool.Put(buf)
|
bufPool.Put(buf)
|
||||||
return
|
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -514,9 +512,9 @@ func parsereq(req *http1request, data []byte) (clen int, resdata []byte, err err
|
|||||||
err = fmt.Errorf("%+v", e)
|
err = fmt.Errorf("%+v", e)
|
||||||
debug.PrintStack()
|
debug.PrintStack()
|
||||||
}
|
}
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
||||||
// method, path, proto line
|
// method, path, proto line
|
||||||
|
|
||||||
req.Proto = ""
|
req.Proto = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user