Commit 4909c4c0 authored by Tom Bergan's avatar Tom Bergan

http2: fix incorrect panic

Previously, we panic'd on sending WINDOW_UPDATE on the half-closed-local
state. However, the RFC allows sending WINDOW_UPDATE in this state, so
we should no panic.

Change-Id: I702b2d5ad525837d7b8c650b7a2ed3f16371be63
Reviewed-on: https://go-review.googlesource.com/34498
Run-TryBot: Tom Bergan <tombergan@google.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 989b0d93
......@@ -936,9 +936,15 @@ func (sc *serverConn) startFrameWrite(wr FrameWriteRequest) {
if st != nil {
switch st.state {
case stateHalfClosedLocal:
panic("internal error: attempt to send frame on half-closed-local stream")
switch wr.write.(type) {
case StreamError, handlerPanicRST, writeWindowUpdate:
// RFC 7540 Section 5.1 allows sending RST_STREAM, PRIORITY, and WINDOW_UPDATE
// in this state. (We never send PRIORITY from the server, so that is not checked.)
default:
panic(fmt.Sprintf("internal error: attempt to send frame on a half-closed-local stream: %v", wr))
}
case stateClosed:
panic(fmt.Sprintf("internal error: attempt to send a write %v on a closed stream", wr))
panic(fmt.Sprintf("internal error: attempt to send frame a closed stream: %v", wr))
}
}
if wpp, ok := wr.write.(*writePushPromise); ok {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment