Files
swift-nio/Tests/NIOHTTP1Tests/HTTPHeadersTest+XCTest.swift
T
Norman Maurer a7614d9180 Reuse detected keepalive of http_parser as long as possible (#299)
Motivation:

To detect if keepalive is used we need to search the headers (if HTTP/1.1 is used). This may be expensive depending how many headers are present. http_parser itself detects already if keep alive should be used and so we can re-use this as long as the user did not modify the headers.

Modifications:

Reuse keepalive parsed by http_parser as long as the headers were not modified.

Result:

Less overhead as long as the headers are not modified.
2018-05-14 18:04:52 +02:00

44 lines
1.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
//
//===----------------------------------------------------------------------===//
//
// HTTPHeadersTest+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 HTTPHeadersTest {
static var allTests : [(String, (HTTPHeadersTest) -> () throws -> Void)] {
return [
("testCasePreservedButInsensitiveLookup", testCasePreservedButInsensitiveLookup),
("testWriteHeadersSeparately", testWriteHeadersSeparately),
("testRevealHeadersSeparately", testRevealHeadersSeparately),
("testSubscriptDoesntSplitHeaders", testSubscriptDoesntSplitHeaders),
("testCanonicalisationDoesntHappenForSetCookie", testCanonicalisationDoesntHappenForSetCookie),
("testTrimWhitespaceWorksOnEmptyString", testTrimWhitespaceWorksOnEmptyString),
("testTrimWhitespaceWorksOnOnlyWhitespace", testTrimWhitespaceWorksOnOnlyWhitespace),
("testTrimWorksWithCharactersInTheMiddleAndWhitespaceAround", testTrimWorksWithCharactersInTheMiddleAndWhitespaceAround),
("testContains", testContains),
("testKeepAliveStateStartsWithClose", testKeepAliveStateStartsWithClose),
("testKeepAliveStateStartsWithKeepAlive", testKeepAliveStateStartsWithKeepAlive),
]
}
}