From eab16d6c474119e643cd9787f15a51a204f3b7f9 Mon Sep 17 00:00:00 2001 From: David Hontecillas Date: Tue, 16 Apr 2024 14:42:14 +0200 Subject: [PATCH 1/2] fix bad interface cast in response_writer --- http/server/response_writer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/http/server/response_writer.go b/http/server/response_writer.go index dc5c283..61d8107 100644 --- a/http/server/response_writer.go +++ b/http/server/response_writer.go @@ -82,12 +82,14 @@ func (w *TrackingResponseWriter) Flush() { func newTrackingResponseWriter(rw http.ResponseWriter, t *tracking, recordHeaders bool, hijackCallback func(net.Conn, error) (net.Conn, error), ) *TrackingResponseWriter { + flusher, _ := rw.(http.Flusher) + hijacker, _ := rw.(http.Hijacker) return &TrackingResponseWriter{ track: t, recordHeaders: recordHeaders, rw: rw, - flusher: rw.(http.Flusher), - hijacker: rw.(http.Hijacker), + flusher: flusher, + hijacker: hijacker, hijackCallback: hijackCallback, } } From 9c851bb902eea3d77ef263da1c4ab078de64a339 Mon Sep 17 00:00:00 2001 From: David Hontecillas Date: Tue, 16 Apr 2024 14:46:02 +0200 Subject: [PATCH 2/2] fix bad interface conversion in tracking --- http/server/tracking.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http/server/tracking.go b/http/server/tracking.go index 429ae77..b640333 100644 --- a/http/server/tracking.go +++ b/http/server/tracking.go @@ -50,7 +50,8 @@ func newTracking() *tracking { func fromContext(ctx context.Context) *tracking { v := ctx.Value(krakenDContextTrackingStrKey) if v != nil { - return v.(*tracking) + t, _ := v.(*tracking) + return t } return nil }