overloaded BuildReponse in http_parser

This commit is contained in:
wouter spruit 2014-09-22 14:55:16 +02:00 committed by Thulinma
parent ee12bb4e9c
commit d0f2f78517
2 changed files with 12 additions and 0 deletions

View file

@ -92,6 +92,17 @@ std::string & HTTP::Parser::BuildResponse(std::string code, std::string message)
return builder; return builder;
} }
/// Returns a string containing a valid HTTP 1.0 or 1.1 response, ready for sending.
/// The response is partly build from internal variables set before this call is made.
/// To be precise, protocol, headers and body are used.
/// \param code The HTTP response code. Usually you want 200.
/// \param message The HTTP response message. Usually you want "OK".
/// \return A string containing a valid HTTP 1.0 or 1.1 response, ready for sending.
/// This function calls this->BuildResponse(this->method,this->url)
std::string & HTTP::Parser::BuildResponse() {
return BuildResponse(method,url);
}
/// Creates and sends a valid HTTP 1.0 or 1.1 response. /// Creates and sends a valid HTTP 1.0 or 1.1 response.
/// The response is partly build from internal variables set before this call is made. /// The response is partly build from internal variables set before this call is made.
/// To be precise, protocol, headers and body are used. /// To be precise, protocol, headers and body are used.

View file

@ -25,6 +25,7 @@ namespace HTTP {
void SetBody(std::string s); void SetBody(std::string s);
void SetBody(char * buffer, int len); void SetBody(char * buffer, int len);
std::string & BuildRequest(); std::string & BuildRequest();
std::string & BuildResponse();
std::string & BuildResponse(std::string code, std::string message); std::string & BuildResponse(std::string code, std::string message);
void SendRequest(Socket::Connection & conn); void SendRequest(Socket::Connection & conn);
void SendResponse(std::string code, std::string message, Socket::Connection & conn); void SendResponse(std::string code, std::string message, Socket::Connection & conn);