From a6f2736b80fc9b3d7c2d5875f99164cd5bc4bcac Mon Sep 17 00:00:00 2001 From: fatedier Date: Tue, 23 Jan 2018 16:31:59 +0800 Subject: [PATCH] fix plugin http_proxy error --- client/proxy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/proxy.go b/client/proxy.go index 109be9f8..f68d9fba 100644 --- a/client/proxy.go +++ b/client/proxy.go @@ -412,10 +412,11 @@ func HandleTcpWorkConnection(localInfo *config.LocalSvrConf, proxyPlugin plugin. err error ) remote = workConn - defer remote.Close() + if baseInfo.UseEncryption { remote, err = frpIo.WithEncryption(remote, encKey) if err != nil { + workConn.Close() workConn.Error("create encryption stream error: %v", err) return } @@ -433,6 +434,7 @@ func HandleTcpWorkConnection(localInfo *config.LocalSvrConf, proxyPlugin plugin. } else { localConn, err := frpNet.ConnectServer("tcp", fmt.Sprintf("%s:%d", localInfo.LocalIp, localInfo.LocalPort)) if err != nil { + workConn.Close() workConn.Error("connect to local service [%s:%d] error: %v", localInfo.LocalIp, localInfo.LocalPort, err) return }