Instance Methodswift-nio 2.72.0NIOHTTP1->NIOCore
configureHTTPServerPipeline(position:withPipeliningAssistance:withServerUpgrade:withErrorHandling:withOutboundHeaderValidation:withEncoderConfiguration:)
Configure a ChannelPipeline
for use as a HTTP server.
func configureHTTPServerPipeline(position: ChannelPipeline.Position = .last, withPipeliningAssistance pipelining: Bool = true, withServerUpgrade upgrade: NIOHTTPServerUpgradeConfiguration? = nil, withErrorHandling errorHandling: Bool = true, withOutboundHeaderValidation headerValidation: Bool = true, withEncoderConfiguration encoderConfiguration: HTTPResponseEncoder.Configuration = .init()) -> EventLoopFuture<Void>
Parameters
- position
Where in the pipeline to add the HTTP server handlers, defaults to
.last
.- pipelining
Whether to provide assistance handling HTTP clients that pipeline their requests. Defaults to
true
. Iffalse
, users will need to handle clients that pipeline themselves.- upgrade
Whether to add a
HTTPServerUpgradeHandler
to the pipeline, configured for HTTP upgrade. Defaults tonil
, which will not add the handler to the pipeline. If provided should be a tuple of an array ofHTTPServerProtocolUpgrader
and the upgrade completion handler. See the documentation onHTTPServerUpgradeHandler
for more details.- errorHandling
Whether to provide assistance handling protocol errors (e.g. failure to parse the HTTP request) by sending 400 errors. Defaults to
true
.- headerValidation
Whether to validate outbound request headers to confirm that they meet spec compliance. Defaults to
true
.- encoderConfiguration
The configuration for the
HTTPResponseEncoder
.
Returns
An EventLoopFuture
that will fire when the pipeline is configured.
This function knows how to set up all first-party HTTP channel handlers appropriately for server use. It supports the following features:
Providing assistance handling clients that pipeline HTTP requests, using the
HTTPServerPipelineHandler
.Supporting HTTP upgrade, using the
HTTPServerUpgradeHandler
.Providing assistance handling protocol errors.
Validating outbound header fields to protect against response splitting attacks.
This method will likely be extended in future with more support for other first-party features.
Other members in extension
Instance members
func addHTTPClientHandlers(position: Position, leftOverBytesStrategy: RemoveAfterUpgradeStrategy
) -> EventLoopFuture<Void> Configure a
ChannelPipeline
for use as a HTTP client.func addHTTPClientHandlers(position: Position, leftOverBytesStrategy: RemoveAfterUpgradeStrategy, enableOutboundHeaderValidation: Bool, encoderConfiguration: HTTPRequestEncoder.Configuration, withClientUpgrade: NIOHTTPClientUpgradeConfiguration?
) -> EventLoopFuture<Void> Configure a
ChannelPipeline
for use as a HTTP client.func addHTTPClientHandlers(position: Position, leftOverBytesStrategy: RemoveAfterUpgradeStrategy, enableOutboundHeaderValidation: Bool, withClientUpgrade: NIOHTTPClientUpgradeConfiguration?
) -> EventLoopFuture<Void> Configure a
ChannelPipeline
for use as a HTTP client.func addHTTPClientHandlers(position: Position, leftOverBytesStrategy: RemoveAfterUpgradeStrategy, withClientUpgrade: NIOHTTPClientUpgradeConfiguration?
) -> EventLoopFuture<Void> Configure a
ChannelPipeline
for use as a HTTP client with a client upgrader configuration.func configureHTTPServerPipeline(position: ChannelPipeline.Position, withPipeliningAssistance: Bool, withServerUpgrade: NIOHTTPServerUpgradeConfiguration?, withErrorHandling: Bool
) -> EventLoopFuture<Void> Configure a
ChannelPipeline
for use as a HTTP server.func configureHTTPServerPipeline(position: ChannelPipeline.Position, withPipeliningAssistance: Bool, withServerUpgrade: NIOHTTPServerUpgradeConfiguration?, withErrorHandling: Bool, withOutboundHeaderValidation: Bool
) -> EventLoopFuture<Void> Configure a
ChannelPipeline
for use as a HTTP server.func configureUpgradableHTTPClientPipeline<UpgradeResult>(configuration: NIOUpgradableHTTPClientPipelineConfiguration<UpgradeResult>
) -> EventLoopFuture<EventLoopFuture<UpgradeResult>> Configure a
ChannelPipeline
for use as an HTTP client.func configureUpgradableHTTPServerPipeline<UpgradeResult>(configuration: NIOUpgradableHTTPServerPipelineConfiguration<UpgradeResult>
) -> EventLoopFuture<EventLoopFuture<UpgradeResult>> Configure a
ChannelPipeline
for use as an HTTP server.