Skip to content

Commit 1642b9b

Browse files
blink-so[bot]f0ssel
andcommitted
Add debug logging to trace http.Serve connection handling
- Log before and after http.Serve calls - Add debugging comments to connection wrapper - Should reveal why http.Serve is not calling handlers - Helps diagnose connection reset issue Co-authored-by: f0ssel <[email protected]>
1 parent 22f42a3 commit 1642b9b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

proxy/proxy.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,9 @@ func (p *Server) handleConnectionWithTLSDetection(conn net.Conn) {
541541
} else {
542542
p.logger.Debug("Detected HTTP request, handling normally")
543543
// Use HTTP server with regular connection
544-
http.Serve(&singleConnectionListener{conn: connWrapper}, http.HandlerFunc(p.handleHTTP))
544+
p.logger.Debug("About to call http.Serve for HTTP connection")
545+
err = http.Serve(&singleConnectionListener{conn: connWrapper}, http.HandlerFunc(p.handleHTTP))
546+
p.logger.Debug("http.Serve completed", "error", err)
545547
}
546548
}
547549

@@ -830,6 +832,8 @@ func (c *connectionWrapper) Read(p []byte) (int, error) {
830832
if !c.bufUsed && len(c.buf) > 0 {
831833
n := copy(p, c.buf)
832834
c.bufUsed = true
835+
// Debug: log that we're returning the unread byte
836+
// p.logger.Debug("connectionWrapper returning unread byte", "byte", c.buf[0])
833837
return n, nil
834838
}
835839
return c.Conn.Read(p)

0 commit comments

Comments
 (0)