From 9ff1cc0acf271d9570e6c70c57add750dc8fcfaa Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 26 Nov 2018 04:27:11 +0100 Subject: [PATCH] Added algorithm include, fixed off-by-one error in http::get_parameter() --- src/http.cpp | 4 ++-- src/libravatarserv.cpp | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/http.cpp b/src/http.cpp index 3e04c49..c2c8f5a 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -15,12 +15,12 @@ */ #include +#include #include #include "libravatarserv.hpp" using std::cout; using std::cerr; -using global::avatar_dir; using namespace http; const Request http::parse_request(const string &request) @@ -74,7 +74,7 @@ const string http::get_parameter(const string &request, const string ¶meter) std::size_t pos = request.find(parameter + "="); if (pos != std::string::npos) { - pos += parameter.length(); + pos += (1 + parameter.length()); return request.substr(pos, request.find('&', pos)); } diff --git a/src/libravatarserv.cpp b/src/libravatarserv.cpp index f6ef15b..2a5f007 100644 --- a/src/libravatarserv.cpp +++ b/src/libravatarserv.cpp @@ -15,7 +15,6 @@ */ #include -#include #include #include #include "version.hpp"