diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-22 18:33:19 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-22 18:33:19 +0000 |
commit | 06757ae99416cf46a356b770960fdf0c4a4eefbe (patch) | |
tree | c62c45fa0f8af3187235da13c485fddc99e2fd95 /net/server | |
parent | e32bb2e5c5533486e9cf4405c9ea3a4640701f33 (diff) | |
download | chromium_src-06757ae99416cf46a356b770960fdf0c4a4eefbe.zip chromium_src-06757ae99416cf46a356b770960fdf0c4a4eefbe.tar.gz chromium_src-06757ae99416cf46a356b770960fdf0c4a4eefbe.tar.bz2 |
Change HttpConnection to reuse GetHttpReasonPhrase.
Before it hardcoded its own reason phrases. This way is simpler and allows
us to use other status codes.
BUG=none
Review URL: https://chromiumcodereview.appspot.com/19639002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212929 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/server')
-rw-r--r-- | net/server/http_connection.cc | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/net/server/http_connection.cc b/net/server/http_connection.cc index ab133c3..66541fa 100644 --- a/net/server/http_connection.cc +++ b/net/server/http_connection.cc @@ -32,29 +32,13 @@ void HttpConnection::Send(HttpStatusCode status_code, if (!socket_.get()) return; - std::string status_message; - switch (status_code) { - case HTTP_OK: - status_message = "OK"; - break; - case HTTP_NOT_FOUND: - status_message = "Not Found"; - break; - case HTTP_INTERNAL_SERVER_ERROR: - status_message = "Internal Error"; - break; - default: - status_message = ""; - break; - } - socket_->Send(base::StringPrintf( "HTTP/1.1 %d %s\r\n" "Content-Type:%s\r\n" "Content-Length:%d\r\n" "\r\n", status_code, - status_message.c_str(), + GetHttpReasonPhrase(status_code), content_type.c_str(), static_cast<int>(data.length()))); socket_->Send(data); |