HTTP/2: Treat MAX_CONCURRENT_STREAMS exceeded as a stream error.

Motivation:

As per the HTTP/2 spec, exceeding the MAX_CONCURRENT_STREAMS should be treated as a stream error as opposed to a connection error.

"An endpoint that receives a HEADERS frame that causes its advertised concurrent stream limit to be exceeded MUST treat this as a stream error (Section 5.4.2) of type PROTOCOL_ERROR or REFUSED_STREAM." http://httpwg.org/specs/rfc7540.html#rfc.section.5.1.2

Modifications:

Make the error a stream error.

Result:

It's a stream error.
This commit is contained in:
buchgr 2016-08-16 19:14:42 +02:00 committed by Norman Maurer
parent e7449b1ef3
commit d568cfc14a

View File

@ -1050,7 +1050,7 @@ public class DefaultHttp2Connection implements Http2Connection {
}
if (state.localSideOpen() || state.remoteSideOpen()) {
if (!canOpenStream()) {
throw connectionError(REFUSED_STREAM, "Maximum active streams violated for this endpoint.");
throw streamError(streamId, REFUSED_STREAM, "Maximum active streams violated for this endpoint.");
}
} else if (numStreams == maxStreams) {
throw streamError(streamId, REFUSED_STREAM, "Maximum streams violated for this endpoint.");