]> git.tdb.fi Git - libs/net.git/blobdiff - source/server.cpp
Exception changes
[libs/net.git] / source / server.cpp
index 45bf69b285bef06da567dc599160bdd44f30dc36..259d13b087598d5ae602f1c4b16e7ec6ed24259e 100644 (file)
@@ -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");
 }