From 5f6c5ae5527619f7ffc82a69cf73d3fc7347e51f Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 7 Apr 2015 01:24:18 +0300 Subject: [PATCH] Reject requests with a relative path As per the HTTP specification --- source/http/server.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- 2.43.0