From 0f905b612e596dc41ab3a74e005cff517b00c0c6 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Mon, 31 Oct 2011 19:48:29 +0100 Subject: [PATCH] Re-fix for HTTP lib, fixed typo in Controller. --- DDV_Controller/main.cpp | 2 +- util/http_parser.cpp | 5 ++--- util/http_parser.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/DDV_Controller/main.cpp b/DDV_Controller/main.cpp index 6c660107..5c898a65 100644 --- a/DDV_Controller/main.cpp +++ b/DDV_Controller/main.cpp @@ -466,7 +466,7 @@ int main(int argc, char ** argv){ // They are assumed to be authorized, but authorization to gearbox is still done. // This authorization uses the compiled-in username and password (account). if (!JsonParse.parse(it->H.body, Request, false)){ - Log("HTTP", "Failed to parse body JSON: "+it->H.body); + Log("UPLK", "Failed to parse body JSON: "+it->H.body); Response["authorize"]["status"] = "INVALID"; }else{ if (Request["authorize"]["status"] != "OK"){ diff --git a/util/http_parser.cpp b/util/http_parser.cpp index 2e7f7239..d2b2ac89 100644 --- a/util/http_parser.cpp +++ b/util/http_parser.cpp @@ -158,8 +158,7 @@ bool HTTP::Parser::parse(){ f = tmpA.find(' '); if (f != std::string::npos){protocol = tmpA.substr(0, f); tmpA.erase(0, f+1);} if (url.find('?') != std::string::npos){ - std::string queryvars = url.substr(url.find('?')+1); - parseVars(queryvars); //parse GET variables + parseVars(url.substr(url.find('?')+1)); //parse GET variables } }else{ if (tmpA.size() == 0){ @@ -204,7 +203,7 @@ void HTTP::Parser::SendResponse(Socket::Connection & conn, std::string code, std /// Parses GET or POST-style variable data. /// Saves to internal variable structure using HTTP::Parser::SetVar. -void HTTP::Parser::parseVars(std::string & data){ +void HTTP::Parser::parseVars(std::string data){ std::string varname; std::string varval; while (data.find('=') != std::string::npos){ diff --git a/util/http_parser.h b/util/http_parser.h index 6172ac00..124b9686 100644 --- a/util/http_parser.h +++ b/util/http_parser.h @@ -41,7 +41,7 @@ namespace HTTP{ bool seenHeaders; bool seenReq; bool parse(); - void parseVars(std::string & data); + void parseVars(std::string data); std::string HTTPbuffer; std::map headers; std::map vars;