mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-27 05:04:23 +00:00
Motivation: We don't currently support ALTSVC and ORIGIN frames. At the moment when receiving or attempting to write these frames we trap. Trapping when receiving an unsupported frame can lead to DoS attacks. Moreover these frames are non critical so can safely be ignored. Modifications: - Forward inbound and outbound ALTSVC and ORIGIN frames to the connection state machine - The connection state machine now ignores inbound frames of this type - The connection state machine traps on outbound frames of this type (as per the current behaviour) - Document this behaviour on `HTTP2Frame.FramePayload` - Tests and fuzz testing failure case Result: We don't trap when receiving unsupported frames.
85 lines
5.8 KiB
Swift
85 lines
5.8 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// SimpleClientServerFramePayloadStreamTests+XCTest.swift
|
|
//
|
|
import XCTest
|
|
|
|
///
|
|
/// NOTE: This file was generated by generate_linux_tests.rb
|
|
///
|
|
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
|
///
|
|
|
|
extension SimpleClientServerFramePayloadStreamTests {
|
|
|
|
@available(*, deprecated, message: "not actually deprecated. Just deprecated to allow deprecated tests (which test deprecated functionality) without warnings")
|
|
static var allTests : [(String, (SimpleClientServerFramePayloadStreamTests) -> () throws -> Void)] {
|
|
return [
|
|
("testBasicRequestResponse", testBasicRequestResponse),
|
|
("testBasicRequestResponseWithDynamicPipeline", testBasicRequestResponseWithDynamicPipeline),
|
|
("testManyRequestsAtOnce", testManyRequestsAtOnce),
|
|
("testNothingButGoaway", testNothingButGoaway),
|
|
("testGoAwayWithStreamsUpQuiescing", testGoAwayWithStreamsUpQuiescing),
|
|
("testLargeDataFramesAreSplit", testLargeDataFramesAreSplit),
|
|
("testSendingDataFrameWithSmallFile", testSendingDataFrameWithSmallFile),
|
|
("testSendingDataFrameWithLargeFile", testSendingDataFrameWithLargeFile),
|
|
("testMoreRequestsThanMaxConcurrentStreamsAtOnce", testMoreRequestsThanMaxConcurrentStreamsAtOnce),
|
|
("testOverridingDefaultSettings", testOverridingDefaultSettings),
|
|
("testBasicPingFrames", testBasicPingFrames),
|
|
("testAutomaticFlowControl", testAutomaticFlowControl),
|
|
("testPartialFrame", testPartialFrame),
|
|
("testSendingTrailers", testSendingTrailers),
|
|
("test1XXResponseHeaderFields", test1XXResponseHeaderFields),
|
|
("testPriorityFrames", testPriorityFrames),
|
|
("testStreamClosedWithNoError", testStreamClosedWithNoError),
|
|
("testStreamClosedViaRstStream", testStreamClosedViaRstStream),
|
|
("testStreamClosedViaGoaway", testStreamClosedViaGoaway),
|
|
("testStreamCloseEventForRstStreamFiresAfterFrame", testStreamCloseEventForRstStreamFiresAfterFrame),
|
|
("testStreamCloseEventForGoawayFiresAfterFrame", testStreamCloseEventForGoawayFiresAfterFrame),
|
|
("testManyConcurrentInactiveStreams", testManyConcurrentInactiveStreams),
|
|
("testBadClientMagic", testBadClientMagic),
|
|
("testOpeningWindowsViaSettingsInitialWindowSize", testOpeningWindowsViaSettingsInitialWindowSize),
|
|
("testSettingsAckNotifiesAboutChangedFlowControl", testSettingsAckNotifiesAboutChangedFlowControl),
|
|
("testStreamMultiplexerAcknowledgesSettingsBasedFlowControlChanges", testStreamMultiplexerAcknowledgesSettingsBasedFlowControlChanges),
|
|
("testChangingMaxFrameSize", testChangingMaxFrameSize),
|
|
("testStreamErrorOnSelfDependentPriorityFrames", testStreamErrorOnSelfDependentPriorityFrames),
|
|
("testStreamErrorOnSelfDependentHeadersFrames", testStreamErrorOnSelfDependentHeadersFrames),
|
|
("testInvalidRequestHeaderBlockAllowsRstStream", testInvalidRequestHeaderBlockAllowsRstStream),
|
|
("testClientConnectionErrorCorrectlyReported", testClientConnectionErrorCorrectlyReported),
|
|
("testChangingMaxConcurrentStreams", testChangingMaxConcurrentStreams),
|
|
("testFailsPromisesForBufferedWrites", testFailsPromisesForBufferedWrites),
|
|
("testAllowPushPromiseBeforeReceivingHeadersNoBody", testAllowPushPromiseBeforeReceivingHeadersNoBody),
|
|
("testAllowPushPromiseBeforeReceivingHeadersWithPossibleBody", testAllowPushPromiseBeforeReceivingHeadersWithPossibleBody),
|
|
("testSequentialEmptyDataFramesIsForbidden", testSequentialEmptyDataFramesIsForbidden),
|
|
("testSequentialEmptyDataFramesLimitIsConfigurable", testSequentialEmptyDataFramesLimitIsConfigurable),
|
|
("testDenialOfServiceViaPing", testDenialOfServiceViaPing),
|
|
("testDenialOfServiceViaSettings", testDenialOfServiceViaSettings),
|
|
("testFramesArentWrittenWhenChannelIsntWritable", testFramesArentWrittenWhenChannelIsntWritable),
|
|
("testEnforcingMaxHeaderListSize", testEnforcingMaxHeaderListSize),
|
|
("testForbidsExceedingMaxHeaderListSizeBeforeDecoding", testForbidsExceedingMaxHeaderListSizeBeforeDecoding),
|
|
("testForbidsExceedingMaxHeaderListSizeBeforeDecodingSingleFrame", testForbidsExceedingMaxHeaderListSizeBeforeDecodingSingleFrame),
|
|
("testNoStreamWindowUpdateOnEndStreamFrameFromServer", testNoStreamWindowUpdateOnEndStreamFrameFromServer),
|
|
("testNoStreamWindowUpdateOnEndStreamFrameFromClient", testNoStreamWindowUpdateOnEndStreamFrameFromClient),
|
|
("testGreasedSettingsAreTolerated", testGreasedSettingsAreTolerated),
|
|
("testStreamCreationOrder", testStreamCreationOrder),
|
|
("testStreamClosedInvalidRequestHeaders", testStreamClosedInvalidRequestHeaders),
|
|
("testHTTP2HandlerDoesNotFlushExcessively", testHTTP2HandlerDoesNotFlushExcessively),
|
|
("testHTTPHandlerIgnoresInboundAltServiceFrames", testHTTPHandlerIgnoresInboundAltServiceFrames),
|
|
("testHTTPHandlerIgnoresInboundOriginFrames", testHTTPHandlerIgnoresInboundOriginFrames),
|
|
]
|
|
}
|
|
}
|
|
|