From: Mikko Rasa Date: Mon, 6 Apr 2015 22:24:18 +0000 (+0300) Subject: Reject requests with a relative path X-Git-Url: http://git.tdb.fi/?p=libs%2Fnet.git;a=commitdiff_plain;h=5f6c5ae5527619f7ffc82a69cf73d3fc7347e51f Reject requests with a relative path As per the HTTP specification --- diff --git a/source/http/server.cpp b/source/http/server.cpp index e0b34b3..ed3a2b9 100644 --- a/source/http/server.cpp +++ b/source/http/server.cpp @@ -106,6 +106,11 @@ void Server::client_data_available(Client &cl) response = new Response(NOT_IMPLEMENTED); response->add_content("Method not implemented\n"); } + else if(cl.request->get_path()[0]!='/') + { + response = new Response(BAD_REQUEST); + response->add_content("Path must be absolute\n"); + } } catch(const exception &e) {