summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/dnsclient_unix.go4
-rw-r--r--src/net/http/h2_bundle.go22
2 files changed, 18 insertions, 8 deletions
diff --git a/src/net/dnsclient_unix.go b/src/net/dnsclient_unix.go
index c291d5e..8b3dd53 100644
--- a/src/net/dnsclient_unix.go
+++ b/src/net/dnsclient_unix.go
@@ -267,7 +267,9 @@ func extractExtendedRCode(p dnsmessage.Parser, hdr dnsmessage.Header) dnsmessage
if ahdr.Type == dnsmessage.TypeOPT {
return ahdr.ExtendedRCode(hdr.RCode)
}
- p.SkipAdditional()
+ if err := p.SkipAdditional(); err != nil {
+ return hdr.RCode
+ }
}
}
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
index 75454db..c1a2e76 100644
--- a/src/net/http/h2_bundle.go
+++ b/src/net/http/h2_bundle.go
@@ -1894,6 +1894,9 @@ func http2terminalReadFrameError(err error) bool {
// returned error is ErrFrameTooLarge. Other errors may be of type
// ConnectionError, StreamError, or anything else from the underlying
// reader.
+//
+// If ReadFrame returns an error and a non-nil Frame, the Frame's StreamID
+// indicates the stream responsible for the error.
func (fr *http2Framer) ReadFrame() (http2Frame, error) {
fr.errDetail = nil
if fr.lastFrame != nil {
@@ -2926,7 +2929,7 @@ func (fr *http2Framer) maxHeaderStringLen() int {
// readMetaFrame returns 0 or more CONTINUATION frames from fr and
// merge them into the provided hf and returns a MetaHeadersFrame
// with the decoded hpack values.
-func (fr *http2Framer) readMetaFrame(hf *http2HeadersFrame) (*http2MetaHeadersFrame, error) {
+func (fr *http2Framer) readMetaFrame(hf *http2HeadersFrame) (http2Frame, error) {
if fr.AllowIllegalReads {
return nil, errors.New("illegal use of AllowIllegalReads with ReadMetaHeaders")
}
@@ -2996,8 +2999,8 @@ func (fr *http2Framer) readMetaFrame(hf *http2HeadersFrame) (*http2MetaHeadersFr
log.Printf("http2: header list too large")
}
// It would be nice to send a RST_STREAM before sending the GOAWAY,
- // but the struture of the server's frame writer makes this difficult.
- return nil, http2ConnectionError(http2ErrCodeProtocol)
+ // but the structure of the server's frame writer makes this difficult.
+ return mh, http2ConnectionError(http2ErrCodeProtocol)
}
// Also close the connection after any CONTINUATION frame following an
@@ -3008,12 +3011,12 @@ func (fr *http2Framer) readMetaFrame(hf *http2HeadersFrame) (*http2MetaHeadersFr
log.Printf("http2: invalid header: %v", invalid)
}
// It would be nice to send a RST_STREAM before sending the GOAWAY,
- // but the struture of the server's frame writer makes this difficult.
- return nil, http2ConnectionError(http2ErrCodeProtocol)
+ // but the structure of the server's frame writer makes this difficult.
+ return mh, http2ConnectionError(http2ErrCodeProtocol)
}
if _, err := hdec.Write(frag); err != nil {
- return nil, http2ConnectionError(http2ErrCodeCompression)
+ return mh, http2ConnectionError(http2ErrCodeCompression)
}
if hc.HeadersEnded() {
@@ -3030,7 +3033,7 @@ func (fr *http2Framer) readMetaFrame(hf *http2HeadersFrame) (*http2MetaHeadersFr
mh.http2HeadersFrame.invalidate()
if err := hdec.Close(); err != nil {
- return nil, http2ConnectionError(http2ErrCodeCompression)
+ return mh, http2ConnectionError(http2ErrCodeCompression)
}
if invalid != nil {
fr.errDetail = invalid
@@ -5297,6 +5300,11 @@ func (sc *http2serverConn) processFrameFromReader(res http2readFrameResult) bool
sc.goAway(http2ErrCodeFlowControl)
return true
case http2ConnectionError:
+ if res.f != nil {
+ if id := res.f.Header().StreamID; id > sc.maxClientStreamID {
+ sc.maxClientStreamID = id
+ }
+ }
sc.logf("http2: server connection error from %v: %v", sc.conn.RemoteAddr(), ev)
sc.goAway(http2ErrCode(ev))
return true // goAway will handle shutdown