forked from quic-go/quic-go
http3: discard body from responses to HEAD requests (#4115)
* http3: HEAD method should not have a body * add tests * Update http3/server.go Co-authored-by: Marten Seemann <martenseemann@gmail.com> * ruduce the size of responseWriter --------- Co-authored-by: Marten Seemann <martenseemann@gmail.com>
This commit is contained in:
@@ -599,6 +599,9 @@ func (s *Server) handleRequest(conn quic.Connection, str quic.Stream, decoder *q
|
||||
ctx = context.WithValue(ctx, http.LocalAddrContextKey, conn.LocalAddr())
|
||||
req = req.WithContext(ctx)
|
||||
r := newResponseWriter(str, conn, s.logger)
|
||||
if req.Method == http.MethodHead {
|
||||
r.isHead = true
|
||||
}
|
||||
handler := s.Handler
|
||||
if handler == nil {
|
||||
handler = http.DefaultServeMux
|
||||
|
||||
Reference in New Issue
Block a user