Skip to content

Commit d9efd45

Browse files
committed
Fix SetReadTimeout compilation error
Replace SetReadTimeout (which doesn't exist) with SetReadDeadline. Also reset the deadline after each successful request to allow multiple requests on the same TLS connection.
1 parent c6ef8d5 commit d9efd45

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

proxy/proxy.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func (p *Server) handleTLSConnection(tlsConn *tls.Conn, hostname string) {
322322
p.logger.Debug("Creating HTTP server for TLS connection", "hostname", hostname)
323323

324324
// Set read timeout to detect hanging connections
325-
tlsConn.SetReadTimeout(5 * time.Second)
325+
tlsConn.SetReadDeadline(time.Now().Add(5 * time.Second))
326326

327327
// Use ReadRequest to manually read HTTP requests from the TLS connection
328328
bufReader := bufio.NewReader(tlsConn)
@@ -363,6 +363,9 @@ func (p *Server) handleTLSConnection(tlsConn *tls.Conn, hostname string) {
363363
p.logger.Debug("Failed to write response", "hostname", hostname, "error", err)
364364
break
365365
}
366+
367+
// Reset read deadline for next request
368+
tlsConn.SetReadDeadline(time.Now().Add(5 * time.Second))
366369
}
367370

368371
p.logger.Debug("TLS connection handling completed", "hostname", hostname)

0 commit comments

Comments
 (0)