Whitespace and pointer cleanup.
This commit is contained in:
parent
6fc0b8dca8
commit
a03eb9599f
32 changed files with 441 additions and 468 deletions
|
@ -1,10 +1,10 @@
|
|||
#include "HttpResponse.h"
|
||||
|
||||
HttpResponse::HttpResponse()
|
||||
:mHttpVersion("1.1"),
|
||||
mResponseCode("200 OK"),
|
||||
mContentType("text/plain"),
|
||||
mBody()
|
||||
:mHttpVersion("1.1"),
|
||||
mResponseCode("200 OK"),
|
||||
mContentType("text/plain"),
|
||||
mBody()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -16,23 +16,23 @@ HttpResponse::~HttpResponse()
|
|||
|
||||
void HttpResponse::SetBody(const std::string& body)
|
||||
{
|
||||
mBody = body;
|
||||
mBody = body;
|
||||
}
|
||||
|
||||
unsigned HttpResponse::GetBodyLength()
|
||||
unsigned HttpResponse::GetBodyLength() const
|
||||
{
|
||||
return unsigned(mBody.length());
|
||||
return unsigned(mBody.length());
|
||||
}
|
||||
|
||||
std::string HttpResponse::GetHeaderString()
|
||||
std::string HttpResponse::GetHeaderString() const
|
||||
{
|
||||
std::string header = "HTTP/" + mHttpVersion + " " + mResponseCode + "\n";
|
||||
header += "Content-Type: " + mContentType + "\n";
|
||||
header += "Content-Length: " + std::to_string(GetBodyLength()) + "\n";
|
||||
return header;
|
||||
std::string header = "HTTP/" + mHttpVersion + " " + mResponseCode + "\n";
|
||||
header += "Content-Type: " + mContentType + "\n";
|
||||
header += "Content-Length: " + std::to_string(GetBodyLength()) + "\n";
|
||||
return header;
|
||||
}
|
||||
|
||||
std::string HttpResponse::ToString()
|
||||
std::string HttpResponse::ToString() const
|
||||
{
|
||||
return GetHeaderString() + "\n\n" + mBody;
|
||||
return GetHeaderString() + "\n\n" + mBody;
|
||||
}
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
class HttpResponse
|
||||
{
|
||||
|
||||
std::string mHttpVersion;
|
||||
std::string mResponseCode;
|
||||
std::string mContentType;
|
||||
std::string mBody;
|
||||
std::string mHttpVersion;
|
||||
std::string mResponseCode;
|
||||
std::string mContentType;
|
||||
std::string mBody;
|
||||
|
||||
public:
|
||||
|
||||
HttpResponse();
|
||||
HttpResponse();
|
||||
|
||||
~HttpResponse();
|
||||
~HttpResponse();
|
||||
|
||||
void SetBody(const std::string& body);
|
||||
void SetBody(const std::string& body);
|
||||
|
||||
unsigned GetBodyLength();
|
||||
unsigned GetBodyLength() const;
|
||||
|
||||
std::string GetHeaderString();
|
||||
std::string GetHeaderString() const;
|
||||
|
||||
std::string ToString();
|
||||
std::string ToString() const;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue