X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fhttp%2Fserver.cpp;fp=source%2Fhttp%2Fserver.cpp;h=60d37c8f139b2b3ee3b344eb2220cbf89487b896;hb=0aae7f2f585a48b21dbe818abcc14058afbdae97;hp=fbacb10accfc6a1de8c4497503c357aa457a16ac;hpb=09858e5a153b0667b4885da81f6f979a0bf29c36;p=libs%2Fnet.git diff --git a/source/http/server.cpp b/source/http/server.cpp index fbacb10..60d37c8 100644 --- a/source/http/server.cpp +++ b/source/http/server.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "request.h" #include "response.h" #include "server.h" @@ -132,7 +133,7 @@ void Server::client_data_available(Client &cl) { cl.keepalive = false; if(cl.request->has_header("Connection")) - cl.keepalive = (cl.request->get_header("Connection")=="keep-alive"); + cl.keepalive = !strcasecmp(cl.request->get_header("Connection"), "keep-alive"); response = new Response(NONE); try @@ -168,6 +169,8 @@ void Server::client_data_available(Client &cl) void Server::send_response(Client &cl, Response &resp) { + if(cl.keepalive) + resp.set_header("Connection", "keep-alive"); cl.sock->write(resp.str()); cl.async = false; if(cl.keepalive)