Skip to content

Commit

Permalink
Remove duplicate metadata adding
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbraemer committed Mar 18, 2022
1 parent 03d336f commit 81777ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 3 additions & 3 deletions api/buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 1 addition & 6 deletions ws/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)))

Expand Down

0 comments on commit 81777ec

Please sign in to comment.