forked from quic-go/quic-go
http3: pass original Conn to ConnContext (#4480)
* http3: Pass original Conn to ConnContext https://github.com/quic-go/quic-go/issues/4479 * Update test to check conn value
This commit is contained in:
@@ -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, http.LocalAddrContextKey, conn.LocalAddr())
|
||||||
ctx = context.WithValue(ctx, RemoteAddrContextKey, conn.RemoteAddr())
|
ctx = context.WithValue(ctx, RemoteAddrContextKey, conn.RemoteAddr())
|
||||||
if s.ConnContext != nil {
|
if s.ConnContext != nil {
|
||||||
ctx = s.ConnContext(ctx, conn)
|
ctx = s.ConnContext(ctx, conn.Connection)
|
||||||
if ctx == nil {
|
if ctx == nil {
|
||||||
panic("http3: ConnContext returned nil")
|
panic("http3: ConnContext returned nil")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ var _ = Describe("Server", func() {
|
|||||||
Expect(req.Host).To(Equal("www.example.com"))
|
Expect(req.Host).To(Equal("www.example.com"))
|
||||||
Expect(req.RemoteAddr).To(Equal("127.0.0.1:1337"))
|
Expect(req.RemoteAddr).To(Equal("127.0.0.1:1337"))
|
||||||
Expect(req.Context().Value(ServerContextKey)).To(Equal(s))
|
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() {
|
It("returns 200 with an empty handler", func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user