mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 07:16:38 +00:00
* Fix WebSocket support by implementing Hijacker interface Add responsewriter.PassthroughWriter to preserve optional HTTP interfaces (Hijacker, Flusher, Pusher) when wrapping http.ResponseWriter in middleware. Without this delegation: - WebSocket connections fail (can't hijack the connection) - Streaming breaks (can't flush buffers) - HTTP/2 push doesn't work * Add HijackTracker to manage hijacked connections during graceful shutdown * Refactor HijackTracker to use middleware for tracking hijacked connections * Refactor server handler chain setup for improved readability and maintainability
19 lines
485 B
Go
19 lines
485 B
Go
package accesslog
|
|
|
|
import (
|
|
"github.com/netbirdio/netbird/proxy/internal/responsewriter"
|
|
)
|
|
|
|
// statusWriter captures the HTTP status code from WriteHeader calls.
|
|
// It embeds responsewriter.PassthroughWriter which handles all the optional
|
|
// interfaces (Hijacker, Flusher, Pusher) automatically.
|
|
type statusWriter struct {
|
|
*responsewriter.PassthroughWriter
|
|
status int
|
|
}
|
|
|
|
func (w *statusWriter) WriteHeader(status int) {
|
|
w.status = status
|
|
w.PassthroughWriter.WriteHeader(status)
|
|
}
|