0

SpoofDPI: fix https-proxy premature connection close

This commit is contained in:
eleksir
2024-10-03 19:17:23 +03:00
parent 43128fc1e9
commit 823f2eaa1a
4 changed files with 161 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
From 8a370430c7d855a63d15337e9781933f6e55707f Mon Sep 17 00:00:00 2001
From: Andrey Semenov <semenov.ao@greendatasoft.ru>
Date: Thu, 19 Sep 2024 17:32:37 +0500
Subject: [PATCH] fix: write to lConn even if any error met and some bytes was
read
---
proxy/handler/https.go | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/proxy/handler/https.go b/proxy/handler/https.go
index f709925..bc320fd 100644
--- a/proxy/handler/https.go
+++ b/proxy/handler/https.go
@@ -2,7 +2,6 @@ package handler
import (
"context"
- "errors"
"io"
"net"
"regexp"
@@ -134,7 +133,7 @@ func (h *HttpsHandler) communicate(ctx context.Context, from *net.TCPConn, to *n
bytesRead, err := ReadBytes(ctx, from, buf)
if err != nil {
- if errors.Is(err, io.EOF) && len(bytesRead) > 0 {
+ if len(bytesRead) > 0 {
h.write(logger, td, to, bytesRead)
}
logger.Debug().Msgf("error reading from %s: %s", fd, err)