diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2011-10-05 12:19:34 -0700 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2011-10-05 12:19:34 -0700 |
commit | e653578db3cb29b5b168d8c16538461eb5087675 (patch) | |
tree | 988385363c9f8f0d40dfeb8c25a95870a8cd4dc9 /src/bitcoinrpc.cpp | |
parent | 9e5322d23aec76413313825e377985ae63c433a5 (diff) | |
parent | ae81b82fb8262148b9f8519d4c9e849048420b8b (diff) | |
download | bitcoin-e653578db3cb29b5b168d8c16538461eb5087675.tar.xz |
Merge pull request #566 from luke-jr/optimize_http_status
Optimize HTTP status messages
Diffstat (limited to 'src/bitcoinrpc.cpp')
-rw-r--r-- | src/bitcoinrpc.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index d3d92c8e7e..e9d8ca6a04 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -1931,12 +1931,13 @@ static string HTTPReply(int nStatus, const string& strMsg) "</HEAD>\r\n" "<BODY><H1>401 Unauthorized.</H1></BODY>\r\n" "</HTML>\r\n", rfc1123Time().c_str(), FormatFullVersion().c_str()); - string strStatus; - if (nStatus == 200) strStatus = "OK"; - else if (nStatus == 400) strStatus = "Bad Request"; - else if (nStatus == 403) strStatus = "Forbidden"; - else if (nStatus == 404) strStatus = "Not Found"; - else if (nStatus == 500) strStatus = "Internal Server Error"; + const char *cStatus; + if (nStatus == 200) cStatus = "OK"; + else if (nStatus == 400) cStatus = "Bad Request"; + else if (nStatus == 403) cStatus = "Forbidden"; + else if (nStatus == 404) cStatus = "Not Found"; + else if (nStatus == 500) cStatus = "Internal Server Error"; + else cStatus = ""; return strprintf( "HTTP/1.1 %d %s\r\n" "Date: %s\r\n" @@ -1947,7 +1948,7 @@ static string HTTPReply(int nStatus, const string& strMsg) "\r\n" "%s", nStatus, - strStatus.c_str(), + cStatus, rfc1123Time().c_str(), strMsg.size(), FormatFullVersion().c_str(), |