fix xnet.Pipe
This commit is contained in:
@@ -218,7 +218,7 @@ func (h *unixHandler) forwardUnix(ctx context.Context, conn net.Conn, target *ch
|
||||
}
|
||||
defer cc.Close()
|
||||
|
||||
var rw io.ReadWriter = conn
|
||||
var rw io.ReadWriteCloser = conn
|
||||
if h.md.sniffing {
|
||||
if h.md.sniffingTimeout > 0 {
|
||||
conn.SetReadDeadline(time.Now().Add(h.md.sniffingTimeout))
|
||||
@@ -232,7 +232,7 @@ func (h *unixHandler) forwardUnix(ctx context.Context, conn net.Conn, target *ch
|
||||
conn.SetReadDeadline(time.Time{})
|
||||
}
|
||||
|
||||
rw = xio.NewReadWriter(br, conn)
|
||||
rw = xio.NewReadWriteCloser(br, conn, conn)
|
||||
switch proto {
|
||||
case sniffing.ProtoHTTP:
|
||||
ro2 := &xrecorder.HandlerRecorderObject{}
|
||||
|
||||
@@ -28,7 +28,7 @@ const (
|
||||
defaultBodySize = 1024 * 1024 // 1MB
|
||||
)
|
||||
|
||||
func (h *unixHandler) handleHTTP(ctx context.Context, rw, cc io.ReadWriter, ro *xrecorder.HandlerRecorderObject, log logger.Logger) error {
|
||||
func (h *unixHandler) handleHTTP(ctx context.Context, rw, cc io.ReadWriteCloser, ro *xrecorder.HandlerRecorderObject, log logger.Logger) error {
|
||||
br := bufio.NewReader(rw)
|
||||
req, err := http.ReadRequest(br)
|
||||
if err != nil {
|
||||
@@ -81,7 +81,7 @@ func (h *unixHandler) handleHTTP(ctx context.Context, rw, cc io.ReadWriter, ro *
|
||||
}
|
||||
}
|
||||
|
||||
func (h *unixHandler) httpRoundTrip(ctx context.Context, rw, cc io.ReadWriter, req *http.Request, ro *xrecorder.HandlerRecorderObject, log logger.Logger) (close bool, err error) {
|
||||
func (h *unixHandler) httpRoundTrip(ctx context.Context, rw, cc io.ReadWriteCloser, req *http.Request, ro *xrecorder.HandlerRecorderObject, log logger.Logger) (close bool, err error) {
|
||||
close = true
|
||||
|
||||
if req == nil {
|
||||
@@ -206,7 +206,7 @@ func (h *unixHandler) httpRoundTrip(ctx context.Context, rw, cc io.ReadWriter, r
|
||||
return resp.Close, nil
|
||||
}
|
||||
|
||||
func (h *unixHandler) handleTLS(ctx context.Context, rw, cc io.ReadWriter, ro *xrecorder.HandlerRecorderObject, log logger.Logger) error {
|
||||
func (h *unixHandler) handleTLS(ctx context.Context, rw, cc io.ReadWriteCloser, ro *xrecorder.HandlerRecorderObject, log logger.Logger) error {
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
clientHello, err := dissector.ParseClientHello(io.TeeReader(rw, buf))
|
||||
|
||||
Reference in New Issue
Block a user