Skip to content

Commit

Permalink
http3: pass original Conn to ConnContext (#4480)
Browse files Browse the repository at this point in the history
* http3: Pass original Conn to ConnContext

#4479

* Update test to check conn value
  • Loading branch information
rthellend authored and marten-seemann committed May 3, 2024
1 parent 93c4785 commit e6b5db0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion http3/server.go
Expand Up @@ -537,7 +537,7 @@ func (s *Server) handleRequest(conn *connection, str quic.Stream, datagrams *dat
ctx = context.WithValue(ctx, http.LocalAddrContextKey, conn.LocalAddr())
ctx = context.WithValue(ctx, RemoteAddrContextKey, conn.RemoteAddr())
if s.ConnContext != nil {
ctx = s.ConnContext(ctx, conn)
ctx = s.ConnContext(ctx, conn.Connection)
if ctx == nil {
panic("http3: ConnContext returned nil")
}
Expand Down
2 changes: 1 addition & 1 deletion http3/server_test.go
Expand Up @@ -169,7 +169,7 @@ var _ = Describe("Server", func() {
Expect(req.Host).To(Equal("www.example.com"))
Expect(req.RemoteAddr).To(Equal("127.0.0.1:1337"))
Expect(req.Context().Value(ServerContextKey)).To(Equal(s))
Expect(req.Context().Value(testConnContextKey("test"))).ToNot(Equal(nil))
Expect(req.Context().Value(testConnContextKey("test"))).To(Equal(conn.Connection))
})

It("returns 200 with an empty handler", func() {
Expand Down

0 comments on commit e6b5db0

Please sign in to comment.