Added session context to http.Request

This commit is contained in:
Thomas De Keulenaer
2017-08-15 18:45:34 +02:00
parent 3390564e98
commit 55a8979bd5
3 changed files with 5 additions and 2 deletions

View File

@@ -83,7 +83,7 @@ func (w *responseWriter) Write(p []byte) (int, error) {
func (w *responseWriter) Flush() {}
// TODO: Implement a functional CloseNotify method.
// This is a NOP. Use http.Request.Context
func (w *responseWriter) CloseNotify() <-chan bool { return make(<-chan bool) }
// test that we implement http.Flusher

View File

@@ -170,6 +170,7 @@ func (s *Server) handleRequest(session streamCreator, headerStream quic.Stream,
return err
}
req.WithContext(session.Context())
req.RemoteAddr = session.RemoteAddr().String()
if utils.Debug() {

View File

@@ -65,7 +65,9 @@ func (s *mockSession) LocalAddr() net.Addr {
func (s *mockSession) RemoteAddr() net.Addr {
return &net.UDPAddr{IP: []byte{127, 0, 0, 1}, Port: 42}
}
func (s *mockSession) Context() context.Context { panic("not implemented") }
func (s *mockSession) Context() context.Context {
return context.Background()
}
var _ = Describe("H2 server", func() {
var (