Skip to content

Commit

Permalink
Ensure tls client is closed if handshake fails
Browse files Browse the repository at this point in the history
The tls client wasn't close when a handshake error occurs, this caused the proxy to keep a connection open without ever responding.
  • Loading branch information
aibaars authored and elazarl committed Jul 19, 2024
1 parent 03be625 commit 6ca80f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion https.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ func (proxy *ProxyHttpServer) handleHttps(w http.ResponseWriter, r *http.Request
go func() {
//TODO: cache connections to the remote website
rawClientTls := tls.Server(proxyClient, tlsConfig)
defer rawClientTls.Close()
if err := rawClientTls.Handshake(); err != nil {
ctx.Warnf("Cannot handshake client %v %v", r.Host, err)
return
}
defer rawClientTls.Close()
clientTlsReader := bufio.NewReader(rawClientTls)
for !isEof(clientTlsReader) {
req, err := http.ReadRequest(clientTlsReader)
Expand Down

0 comments on commit 6ca80f5

Please sign in to comment.