Re-fix for HTTP lib, fixed typo in Controller.

This commit is contained in:
Thulinma 2011-10-31 19:48:29 +01:00
parent 96af25e562
commit 0f905b612e
3 changed files with 4 additions and 5 deletions

View file

@ -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"){

View file

@ -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){

View file

@ -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<std::string, std::string> headers;
std::map<std::string, std::string> vars;