Skip to content

Commit 782fc6a

Browse files
committed
allow sending 100 headers
1 parent f8a62e7 commit 782fc6a

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
@@ -2650,7 +2650,7 @@ func checkWriteHeaderCode(code int) {
26502650
// no equivalent bogus thing we can realistically send in HTTP/2,
26512651
// so we'll consistently panic instead and help people find their bugs
26522652
// early. (We can't return an error from WriteHeader even if we wanted to.)
2653-
if code <= 100 || code > 999 {
2653+
if code < 100 || code > 999 {
26542654
panic(fmt.Sprintf("invalid WriteHeader code %v", code))
26552655
}
26562656
}
@@ -2671,7 +2671,14 @@ func (rws *responseWriterState) writeHeader(code int) {
26712671
checkWriteHeaderCode(code)
26722672

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

0 commit comments

Comments
 (0)