mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Merge pull request #566 from luke-jr/optimize_http_status
Optimize HTTP status messages
This commit is contained in:
commit
e653578db3
@ -1931,12 +1931,13 @@ static string HTTPReply(int nStatus, const string& strMsg)
|
|||||||
"</HEAD>\r\n"
|
"</HEAD>\r\n"
|
||||||
"<BODY><H1>401 Unauthorized.</H1></BODY>\r\n"
|
"<BODY><H1>401 Unauthorized.</H1></BODY>\r\n"
|
||||||
"</HTML>\r\n", rfc1123Time().c_str(), FormatFullVersion().c_str());
|
"</HTML>\r\n", rfc1123Time().c_str(), FormatFullVersion().c_str());
|
||||||
string strStatus;
|
const char *cStatus;
|
||||||
if (nStatus == 200) strStatus = "OK";
|
if (nStatus == 200) cStatus = "OK";
|
||||||
else if (nStatus == 400) strStatus = "Bad Request";
|
else if (nStatus == 400) cStatus = "Bad Request";
|
||||||
else if (nStatus == 403) strStatus = "Forbidden";
|
else if (nStatus == 403) cStatus = "Forbidden";
|
||||||
else if (nStatus == 404) strStatus = "Not Found";
|
else if (nStatus == 404) cStatus = "Not Found";
|
||||||
else if (nStatus == 500) strStatus = "Internal Server Error";
|
else if (nStatus == 500) cStatus = "Internal Server Error";
|
||||||
|
else cStatus = "";
|
||||||
return strprintf(
|
return strprintf(
|
||||||
"HTTP/1.1 %d %s\r\n"
|
"HTTP/1.1 %d %s\r\n"
|
||||||
"Date: %s\r\n"
|
"Date: %s\r\n"
|
||||||
@ -1947,7 +1948,7 @@ static string HTTPReply(int nStatus, const string& strMsg)
|
|||||||
"\r\n"
|
"\r\n"
|
||||||
"%s",
|
"%s",
|
||||||
nStatus,
|
nStatus,
|
||||||
strStatus.c_str(),
|
cStatus,
|
||||||
rfc1123Time().c_str(),
|
rfc1123Time().c_str(),
|
||||||
strMsg.size(),
|
strMsg.size(),
|
||||||
FormatFullVersion().c_str(),
|
FormatFullVersion().c_str(),
|
||||||
|
Loading…
Reference in New Issue
Block a user