From 81777ec1dfd537ab723ed5c5f848b265ce6821ec Mon Sep 17 00:00:00 2001 From: robinbraemer Date: Fri, 18 Mar 2022 08:49:08 +0100 Subject: [PATCH] Remove duplicate metadata adding --- api/buf.lock | 6 +++--- ws/server.go | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/api/buf.lock b/api/buf.lock index 3cc07ce..8c58811 100644 --- a/api/buf.lock +++ b/api/buf.lock @@ -5,6 +5,6 @@ deps: owner: googleapis repository: googleapis branch: main - commit: 6f475a54b1614e6cafd96fd376b1738d - digest: b1-a7t276NpOOZlwSgobbKDlRuKe1lyAcZHdiangmLShGg= - create_time: 2022-03-02T15:12:37.274824Z + commit: c348fb6ca1774f95bdabe20c7b379d50 + digest: b1-liJZ9g7gOLHZca7G3Fu-Z4-9VKgrE3ci0lXsuG8hsVY= + create_time: 2022-03-17T15:04:57.656498Z diff --git a/ws/server.go b/ws/server.go index 9035982..85888fd 100644 --- a/ws/server.go +++ b/ws/server.go @@ -44,11 +44,6 @@ func (o ServerOptions) TunnelHandler(ln connect.TunnelListener) http.Handler { } defer conn.Close() - // Add WebSocket handshake request header to ctx metadata - md, _ := metadata.FromIncomingContext(ctx) - md = metadata.Join(md, metadata.MD(r.Header)) - ctx = metadata.NewIncomingContext(ctx, md) - // Add http request to ctx ctx = withRequest(ctx, r) @@ -148,7 +143,7 @@ func pingLoop(ctx context.Context, d time.Duration, ws *websocket.Conn) { type httpRequestContextKey struct{} func withRequest(ctx context.Context, r *http.Request) context.Context { - // Add websocket handshake request header to metadata + // Add WebSocket handshake request header to metadata md, _ := metadata.FromIncomingContext(ctx) ctx = metadata.NewIncomingContext(ctx, metadata.Join(md, metadata.MD(r.Header)))