Re-fix for HTTP lib, fixed typo in Controller.
This commit is contained in:
parent
96af25e562
commit
0f905b612e
3 changed files with 4 additions and 5 deletions
|
@ -466,7 +466,7 @@ int main(int argc, char ** argv){
|
||||||
// They are assumed to be authorized, but authorization to gearbox is still done.
|
// They are assumed to be authorized, but authorization to gearbox is still done.
|
||||||
// This authorization uses the compiled-in username and password (account).
|
// This authorization uses the compiled-in username and password (account).
|
||||||
if (!JsonParse.parse(it->H.body, Request, false)){
|
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";
|
Response["authorize"]["status"] = "INVALID";
|
||||||
}else{
|
}else{
|
||||||
if (Request["authorize"]["status"] != "OK"){
|
if (Request["authorize"]["status"] != "OK"){
|
||||||
|
|
|
@ -158,8 +158,7 @@ bool HTTP::Parser::parse(){
|
||||||
f = tmpA.find(' ');
|
f = tmpA.find(' ');
|
||||||
if (f != std::string::npos){protocol = tmpA.substr(0, f); tmpA.erase(0, f+1);}
|
if (f != std::string::npos){protocol = tmpA.substr(0, f); tmpA.erase(0, f+1);}
|
||||||
if (url.find('?') != std::string::npos){
|
if (url.find('?') != std::string::npos){
|
||||||
std::string queryvars = url.substr(url.find('?')+1);
|
parseVars(url.substr(url.find('?')+1)); //parse GET variables
|
||||||
parseVars(queryvars); //parse GET variables
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if (tmpA.size() == 0){
|
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.
|
/// Parses GET or POST-style variable data.
|
||||||
/// Saves to internal variable structure using HTTP::Parser::SetVar.
|
/// 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 varname;
|
||||||
std::string varval;
|
std::string varval;
|
||||||
while (data.find('=') != std::string::npos){
|
while (data.find('=') != std::string::npos){
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace HTTP{
|
||||||
bool seenHeaders;
|
bool seenHeaders;
|
||||||
bool seenReq;
|
bool seenReq;
|
||||||
bool parse();
|
bool parse();
|
||||||
void parseVars(std::string & data);
|
void parseVars(std::string data);
|
||||||
std::string HTTPbuffer;
|
std::string HTTPbuffer;
|
||||||
std::map<std::string, std::string> headers;
|
std::map<std::string, std::string> headers;
|
||||||
std::map<std::string, std::string> vars;
|
std::map<std::string, std::string> vars;
|
||||||
|
|
Loading…
Add table
Reference in a new issue