fix plugin http_proxy error

This commit is contained in:
fatedier 2018-01-23 16:31:59 +08:00
parent 902f6f84a5
commit a6f2736b80

View File

@ -412,10 +412,11 @@ func HandleTcpWorkConnection(localInfo *config.LocalSvrConf, proxyPlugin plugin.
err error err error
) )
remote = workConn remote = workConn
defer remote.Close()
if baseInfo.UseEncryption { if baseInfo.UseEncryption {
remote, err = frpIo.WithEncryption(remote, encKey) remote, err = frpIo.WithEncryption(remote, encKey)
if err != nil { if err != nil {
workConn.Close()
workConn.Error("create encryption stream error: %v", err) workConn.Error("create encryption stream error: %v", err)
return return
} }
@ -433,6 +434,7 @@ func HandleTcpWorkConnection(localInfo *config.LocalSvrConf, proxyPlugin plugin.
} else { } else {
localConn, err := frpNet.ConnectServer("tcp", fmt.Sprintf("%s:%d", localInfo.LocalIp, localInfo.LocalPort)) localConn, err := frpNet.ConnectServer("tcp", fmt.Sprintf("%s:%d", localInfo.LocalIp, localInfo.LocalPort))
if err != nil { if err != nil {
workConn.Close()
workConn.Error("connect to local service [%s:%d] error: %v", localInfo.LocalIp, localInfo.LocalPort, err) workConn.Error("connect to local service [%s:%d] error: %v", localInfo.LocalIp, localInfo.LocalPort, err)
return return
} }