mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-29 05:24:22 +00:00
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:
1 parent
9e07639b44
commit
d9f1131749
4 files changed
+25
-1
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user