X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fserver.cpp;h=259d13b087598d5ae602f1c4b16e7ec6ed24259e;hb=c8df43e7794dc82d5604dfa612e464bbc5ca3cdd;hp=45bf69b285bef06da567dc599160bdd44f30dc36;hpb=c3bc44e20b80683ec1e8296a449804ff6c5f7aff;p=libs%2Fnet.git diff --git a/source/server.cpp b/source/server.cpp index 45bf69b..259d13b 100644 --- a/source/server.cpp +++ b/source/server.cpp @@ -55,7 +55,6 @@ void Server::submit_response(Response &resp) if(cl.async) { cl.sock->write(resp.str()); - cl.sock->close(); cl.stale = true; } } @@ -99,7 +98,7 @@ void Server::client_data_available(Client &cl) if(cl.request->get_method()!="GET" && cl.request->get_method()!="POST") { response = new Response(NOT_IMPLEMENTED); - response->add_content("Method not implemented"); + response->add_content("Method not implemented\n"); } } catch(const exception &e) @@ -131,7 +130,7 @@ void Server::client_data_available(Client &cl) if(response->get_status()==NONE) { response = new Response(NOT_FOUND); - response->add_content("The requested resource was not found"); + response->add_content("The requested resource was not found\n"); } } } @@ -146,7 +145,6 @@ void Server::client_data_available(Client &cl) if(response) { cl.sock->write(response->str()); - cl.sock->close(); cl.stale = true; } } @@ -162,7 +160,8 @@ Server::Client &Server::get_client_by_response(Response &resp) if(i->response==&resp) return *i; - throw InvalidParameterValue("Response does not belong to any client"); + // XXX Do this differently + throw invalid_argument("Response does not belong to any client"); }