swifter
swifter copied to clipboard
Socket is closed using .raw response even with keep-alive header
Hi,
I have an issue using .raw response with keep alive header: the socket is closed cause .raw content length cannot be anything but -1 (even if i actually write content using HttpResponseBodyWriter)
private func respond(_ socket: Socket, response: HttpResponse, keepAlive: Bool) throws -> Bool {
guard self.operating else { return false }
[...]
if keepAlive && content.length != -1 {
responseHeader.append("Connection: keep-alive\r\n")
}
[...]
return keepAlive && content.length != -1
I really need the socket to respect the keep-alive for IoT devices usage purposes
Thanks, have a great day,
Matthieu