-
Notifications
You must be signed in to change notification settings - Fork 698
Open
Description
As shown in apple/swift-nio-ssl#539, when responding to a CONNECT request, if you send a .end
then we will happily send a chunk-encoded empty blob. That is, the code below:
func channelRead(context: ChannelHandlerContext, data: NIOAny) {
let part = unwrapInboundIn(data)
guard case let .head(request) = part, request.method == .CONNECT else {
context.fireChannelRead(data)
return
}
connectHost = request.uri.components(separatedBy: ":").first
var responseHead = HTTPResponseHead(version: request.version, status: .ok)
responseHead.headers.add(name: "Connection", value: "Established")
context.write(self.wrapOutboundOut(.head(responseHead)), promise: nil)
context.writeAndFlush(self.wrapOutboundOut(.end(nil))).whenComplete { _ in
self.upgradeToTLS(context: context)
}
}
is incorrect. The .end
should not be sent.
We can do better than this, and refuse to send anything in this context.
Metadata
Metadata
Assignees
Labels
No labels