mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Motivation: Right now we always set the framing headers in HTTP requests and responses that we send. This is a good practice for most users, but it can cause issues, most notably in responses to CONNECT requests which requires that we do not set framing headers. Unfortunately, in NIO's current HTTP/1.1 design it is not possible for us to suppress these headers. This is because the HTTP encoders come _earlier_ in the pipeline than the decoders, so the HTTP encoders do not know structurally what requests they are responding to. While we could merge the encoders/decoders, that's a fairly substantial change. A better short-term change is to offer users the ability to turn off the NIO header manipulation feature. In this circumstance, users take on full responsibility for appropriately framing their HTTP messages. Modifications - Add config to HTTPRequestEncoder and HTTPResponseEncoder. - Plumb this config through. - Add a bunch of tests. Result Users have way more control of HTTP/1.1 messages.