Fixed HTTP parser to no longer require "HTTP*" as protocol when creating requests/responses.
This commit is contained in:
parent
9587d2fff6
commit
0fa40bb373
1 changed files with 4 additions and 4 deletions
|
@ -33,7 +33,7 @@ void HTTP::Parser::Clean(){
|
||||||
std::string & HTTP::Parser::BuildRequest(){
|
std::string & HTTP::Parser::BuildRequest(){
|
||||||
/// \todo Include GET/POST variable parsing?
|
/// \todo Include GET/POST variable parsing?
|
||||||
std::map<std::string, std::string>::iterator it;
|
std::map<std::string, std::string>::iterator it;
|
||||||
if (protocol.size() < 5 || protocol.substr(0, 4) != "HTTP"){
|
if (protocol.size() < 5 || protocol[4] != '/'){
|
||||||
protocol = "HTTP/1.0";
|
protocol = "HTTP/1.0";
|
||||||
}
|
}
|
||||||
builder = method + " " + url + " " + protocol + "\r\n";
|
builder = method + " " + url + " " + protocol + "\r\n";
|
||||||
|
@ -52,7 +52,7 @@ std::string & HTTP::Parser::BuildRequest(){
|
||||||
void HTTP::Parser::SendRequest(Socket::Connection & conn){
|
void HTTP::Parser::SendRequest(Socket::Connection & conn){
|
||||||
/// \todo Include GET/POST variable parsing?
|
/// \todo Include GET/POST variable parsing?
|
||||||
std::map<std::string, std::string>::iterator it;
|
std::map<std::string, std::string>::iterator it;
|
||||||
if (protocol.size() < 5 || protocol.substr(0, 4) != "HTTP"){
|
if (protocol.size() < 5 || protocol[4] != '/'){
|
||||||
protocol = "HTTP/1.0";
|
protocol = "HTTP/1.0";
|
||||||
}
|
}
|
||||||
builder = method + " " + url + " " + protocol + "\r\n";
|
builder = method + " " + url + " " + protocol + "\r\n";
|
||||||
|
@ -76,7 +76,7 @@ void HTTP::Parser::SendRequest(Socket::Connection & conn){
|
||||||
std::string & HTTP::Parser::BuildResponse(std::string code, std::string message){
|
std::string & HTTP::Parser::BuildResponse(std::string code, std::string message){
|
||||||
/// \todo Include GET/POST variable parsing?
|
/// \todo Include GET/POST variable parsing?
|
||||||
std::map<std::string, std::string>::iterator it;
|
std::map<std::string, std::string>::iterator it;
|
||||||
if (protocol.size() < 5 || protocol.substr(0, 4) != "HTTP"){
|
if (protocol.size() < 5 || protocol[4] != '/'){
|
||||||
protocol = "HTTP/1.0";
|
protocol = "HTTP/1.0";
|
||||||
}
|
}
|
||||||
builder = protocol + " " + code + " " + message + "\r\n";
|
builder = protocol + " " + code + " " + message + "\r\n";
|
||||||
|
@ -102,7 +102,7 @@ std::string & HTTP::Parser::BuildResponse(std::string code, std::string message)
|
||||||
void HTTP::Parser::SendResponse(std::string code, std::string message, Socket::Connection & conn){
|
void HTTP::Parser::SendResponse(std::string code, std::string message, Socket::Connection & conn){
|
||||||
/// \todo Include GET/POST variable parsing?
|
/// \todo Include GET/POST variable parsing?
|
||||||
std::map<std::string, std::string>::iterator it;
|
std::map<std::string, std::string>::iterator it;
|
||||||
if (protocol.size() < 5 || protocol.substr(0, 4) != "HTTP"){
|
if (protocol.size() < 5 || protocol[4] != '/'){
|
||||||
protocol = "HTTP/1.0";
|
protocol = "HTTP/1.0";
|
||||||
}
|
}
|
||||||
builder = protocol + " " + code + " " + message + "\r\n";
|
builder = protocol + " " + code + " " + message + "\r\n";
|
||||||
|
|
Loading…
Add table
Reference in a new issue