net/http: update bundled http2
Updates x/net/http2 to git rev 341cd08 for https://golang.org/cl/18576 Change-Id: If5dcb60ac449b798c34fe332ede5ec74e66eb9db Reviewed-on: https://go-review.googlesource.com/18579 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
aba6250250
commit
608ddc38bd
@ -5353,21 +5353,36 @@ func (rl *http2clientConnReadLoop) processData(f *http2DataFrame) error {
|
|||||||
cc := rl.cc
|
cc := rl.cc
|
||||||
cs := cc.streamByID(f.StreamID, f.StreamEnded())
|
cs := cc.streamByID(f.StreamID, f.StreamEnded())
|
||||||
if cs == nil {
|
if cs == nil {
|
||||||
|
cc.mu.Lock()
|
||||||
|
neverSent := cc.nextStreamID
|
||||||
|
cc.mu.Unlock()
|
||||||
|
if f.StreamID >= neverSent {
|
||||||
|
|
||||||
|
cc.logf("http2: Transport received unsolicited DATA frame; closing connection")
|
||||||
|
return http2ConnectionError(http2ErrCodeProtocol)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
data := f.Data()
|
if data := f.Data(); len(data) > 0 {
|
||||||
|
if cs.bufPipe.b == nil {
|
||||||
|
|
||||||
cc.mu.Lock()
|
cc.logf("http2: Transport received DATA frame for closed stream; closing connection")
|
||||||
if cs.inflow.available() >= int32(len(data)) {
|
return http2ConnectionError(http2ErrCodeProtocol)
|
||||||
cs.inflow.take(int32(len(data)))
|
}
|
||||||
} else {
|
|
||||||
|
cc.mu.Lock()
|
||||||
|
if cs.inflow.available() >= int32(len(data)) {
|
||||||
|
cs.inflow.take(int32(len(data)))
|
||||||
|
} else {
|
||||||
|
cc.mu.Unlock()
|
||||||
|
return http2ConnectionError(http2ErrCodeFlowControl)
|
||||||
|
}
|
||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
return http2ConnectionError(http2ErrCodeFlowControl)
|
|
||||||
}
|
|
||||||
cc.mu.Unlock()
|
|
||||||
|
|
||||||
if _, err := cs.bufPipe.Write(data); err != nil {
|
if _, err := cs.bufPipe.Write(data); err != nil {
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.StreamEnded() {
|
if f.StreamEnded() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user