Be emphatic about remote peers making mistakes. (#65)

Motivation:

Receiving a CONTINUATION frame at the wrong stage of a connection is
a PROTOCOL_ERROR, but out of an abundance of caution we were categorising
it as an INTERNAL_ERROR. We should be more confident about our error
categories.

Modifications:

- Changed INTERNAL_ERROR to PROTOCOL_ERROR.
- Added a test for this error case.

Result:

More confidence, more style, more pizazz.
This commit is contained in:
Cory Benfield authored and GitHub committed 2019-03-15 14:37:17 +00:00
1 parent 9e07639b44
commit d9f1131749
4 files changed
+25 -1

No files matched your search

+1 -1
View File
@@ -390,7 +390,7 @@ struct HTTP2FrameDecoder {
}
guard state.header.type != 9 else {
// we shouldn't see any CONTINUATION frames in this state
throw InternalError.codecError(code: .internalError)
throw InternalError.codecError(code: .protocolError)
}
guard state.accumulatedBytes.readableBytes >= state.header.length else {
return .needMoreData