From b86c05f093390a3f8afbf13fbb582d36af71914b Mon Sep 17 00:00:00 2001 From: lqqyt2423 <974923609@qq.com> Date: Tue, 8 Dec 2020 16:10:15 +0800 Subject: [PATCH] =?UTF-8?q?mitm=20=E5=86=85=E9=83=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E8=AE=BE=E7=BD=AE=20socket=20=E5=B0=BD=E5=BF=AB?= =?UTF-8?q?=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy/mitm.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/proxy/mitm.go b/proxy/mitm.go index 6068890..e111e35 100644 --- a/proxy/mitm.go +++ b/proxy/mitm.go @@ -4,7 +4,6 @@ import ( "crypto/tls" "net" "net/http" - "time" "github.com/lqqyt2423/go-mitmproxy/cert" ) @@ -46,7 +45,6 @@ func NewMitmServer(proxy *Proxy) (Mitm, error) { } server := &http.Server{ - IdleTimeout: time.Millisecond * 100, // 尽快关闭内部的连接,释放文件描述符 Handler: m, TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)), // disable http2 TLSConfig: &tls.Config{ @@ -57,6 +55,9 @@ func NewMitmServer(proxy *Proxy) (Mitm, error) { }, } + // 尽快关闭内部的连接,释放文件描述符 + server.SetKeepAlivesEnabled(false) + m.Server = server return m, nil