cl.in_buf.erase(0, len);
}
+ bool keepalive = false;
if(cl.request && cl.request->is_complete() && !response)
{
+ if(cl.request->has_header("Connection"))
+ keepalive = (cl.request->get_header("Connection")=="keep-alive");
+
response = new Response(NONE);
try
{
if(response)
{
cl.sock->write(response->str());
- cl.stale = true;
+ if(keepalive)
+ {
+ delete cl.request;
+ cl.request = 0;
+ delete cl.response;
+ cl.response = 0;
+ }
+ else
+ {
+ cl.sock->shutdown(IO::M_WRITE);
+ cl.stale = true;
+ }
}
}