| Index: net/server/http_connection.cc
|
| diff --git a/net/server/http_connection.cc b/net/server/http_connection.cc
|
| index ab133c37a224232626d0403993a4b5b4f88e3023..d964cb0738b3ad3db912ec79bb0dcdbecf3ee1b4 100644
|
| --- a/net/server/http_connection.cc
|
| +++ b/net/server/http_connection.cc
|
| @@ -4,9 +4,8 @@
|
|
|
| #include "net/server/http_connection.h"
|
|
|
| -#include "base/strings/string_util.h"
|
| -#include "base/strings/stringprintf.h"
|
| #include "net/server/http_server.h"
|
| +#include "net/server/http_server_response_info.h"
|
| #include "net/server/web_socket.h"
|
| #include "net/socket/stream_listen_socket.h"
|
|
|
| @@ -26,38 +25,8 @@ void HttpConnection::Send(const char* bytes, int len) {
|
| socket_->Send(bytes, len);
|
| }
|
|
|
| -void HttpConnection::Send(HttpStatusCode status_code,
|
| - const std::string& data,
|
| - const std::string& content_type) {
|
| - 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(),
|
| - content_type.c_str(),
|
| - static_cast<int>(data.length())));
|
| - socket_->Send(data);
|
| +void HttpConnection::Send(const HttpServerResponseInfo& response) {
|
| + Send(response.Serialize());
|
| }
|
|
|
| HttpConnection::HttpConnection(HttpServer* server, StreamListenSocket* sock)
|
|
|