From 96567f43383aeff3b027d9fdce90980015fec996 Mon Sep 17 00:00:00 2001 From: Fred Nicolson Date: Fri, 9 Jun 2017 11:22:21 +0100 Subject: [PATCH] Fixed HTTP response code not being parsed Forgot to parse it, when re-writing HTTP response parser. --- src/HttpResponse.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/HttpResponse.cpp b/src/HttpResponse.cpp index ace85d3..423cd1c 100644 --- a/src/HttpResponse.cpp +++ b/src/HttpResponse.cpp @@ -71,6 +71,13 @@ namespace fr std::vector header_lines = split_string(body.substr(0, header_end_pos)); if(header_lines.empty()) return false; + + //Get response code + auto status_begin = header_lines[0].find(' '); + if(status_begin == std::string::npos) + return false; + auto end_pos = header_lines[0].find(' ', status_begin + 1); + status = (RequestStatus)std::stoi(header_lines[0].substr(status_begin, end_pos - status_begin)); line++; //Read in headers