From daa6d02887f3cb79ad53d093b2034d146f986f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Gru=C3=9F?= Date: Mon, 1 Jun 2015 09:42:22 +0200 Subject: [PATCH] Content Type validation added --- server/request_parser.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/request_parser.cpp b/server/request_parser.cpp index 07cd52d83..502e6e0b8 100644 --- a/server/request_parser.cpp +++ b/server/request_parser.cpp @@ -60,7 +60,7 @@ RequestParser::parse(request ¤t_request, char *begin, char *end) } osrm::tribool result = osrm::tribool::indeterminate; - if(is_post_header && content_length == 0) + if(state == internal_state::post_request && content_length <= 0) { result = osrm::tribool::yes; } @@ -252,6 +252,13 @@ osrm::tribool RequestParser::consume(request ¤t_request, const char input) // Ignore the header if the parameter isn't an int } } + if (boost::iequals(current_header.name, "Content-Type")) + { + if (!boost::icontains(current_header.value, "application/x-www-form-urlencoded")) + { + return osrm::tribool::no; + } + } if (input == '\r') {