From 118beffe719559184921940714b60e84238061fd Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Sat, 12 Jan 2019 01:04:38 +0100 Subject: [PATCH] require gcc 4.9 because of incomplete regex support in gcc 4.8 --- README.md | 2 +- src/util/http/Server.cpp | 9 +++++---- src/util/http/Server.h | 6 ++++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9a55462..c950989 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Precise map-matching for public transit schedules (GTFS data). ## Requirements * `cmake` - * `gcc >= 4.8` (or `clang >= 5.0`) + * `gcc >= 4.9` (or `clang >= 5.0`) ## Building and Installation diff --git a/src/util/http/Server.cpp b/src/util/http/Server.cpp index 666396b..ecc246c 100644 --- a/src/util/http/Server.cpp +++ b/src/util/http/Server.cpp @@ -110,11 +110,11 @@ void HttpServer::handle() { answ = _handler->handle(req, connection); answ.gzip = gzipSupport(req); } catch (HttpErr err) { - answ = Answer{err.what(), err.what(), false, {}}; + answ = Answer(err.what(), err.what()); } catch (...) { // catch everything to make sure the server continues running - answ = Answer{ - "500 Internal Server Error", "500 Internal Server Error", false, {}}; + answ = Answer( + "500 Internal Server Error", "500 Internal Server Error"); } send(connection, &answ); @@ -151,7 +151,8 @@ Req HttpServer::getReq(int connection) { int64_t curRcvd = 0; HeaderState state = NONE; Req ret{"", "", "", "", {}}; - char *tmp, *tmp2; + char *tmp = 0; + char *tmp2 = 0; char* brk = 0; while ((curRcvd = read(connection, buf + rcvd, BSIZE - rcvd))) { diff --git a/src/util/http/Server.h b/src/util/http/Server.h index 4397d67..ccefed7 100644 --- a/src/util/http/Server.h +++ b/src/util/http/Server.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -62,6 +63,11 @@ struct Req { * HTTP Answer */ struct Answer { + Answer() : status(""), pl(""), gzip(false) {} + Answer(const std::string& status, const std::string& pl) + : status(status), pl(pl), gzip(false) {} + Answer(const std::string& status, const std::string& pl, bool gz) + : status(status), pl(pl), gzip(gz) {} std::string status, pl; bool gzip; std::unordered_map params;