Skip to content

Commit c7bb932

Browse files
committed
allow sending 100 headers
1 parent d839d59 commit c7bb932

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

http2/server.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,7 +2652,7 @@ func checkWriteHeaderCode(code int) {
26522652
// no equivalent bogus thing we can realistically send in HTTP/2,
26532653
// so we'll consistently panic instead and help people find their bugs
26542654
// early. (We can't return an error from WriteHeader even if we wanted to.)
2655-
if code <= 100 || code > 999 {
2655+
if code < 100 || code > 999 {
26562656
panic(fmt.Sprintf("invalid WriteHeader code %v", code))
26572657
}
26582658
}
@@ -2673,7 +2673,14 @@ func (rws *responseWriterState) writeHeader(code int) {
26732673
checkWriteHeaderCode(code)
26742674

26752675
// Handle informational headers, except 100 (Continue) which is handled automatically
2676-
if code > 100 && code < 200 {
2676+
if code >= 100 && code < 200 {
2677+
if code == 100 && rws.body.needsContinue {
2678+
rws.body.needsContinue = false
2679+
rws.conn.write100ContinueHeaders(rws.body.stream)
2680+
2681+
return
2682+
}
2683+
26772684
// Per RFC 8297 we must not clear the current header map
26782685
h := rws.handlerHeader
26792686

0 commit comments

Comments
 (0)