#include <msp/net/resolve.h>
#include <msp/net/streamsocket.h>
#include <msp/strings/format.h>
+#include <msp/strings/utils.h>
#include "request.h"
#include "response.h"
#include "server.h"
{
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
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)