Index: net/server/http_server.cc |
diff --git a/net/server/http_server.cc b/net/server/http_server.cc |
index b78073983aed08b1e69400e51e2deb819dd39e6f..d4690ba411ede205d271c4c34a40b4a65d188115 100644 |
--- a/net/server/http_server.cc |
+++ b/net/server/http_server.cc |
@@ -11,8 +11,10 @@ |
#include "base/strings/stringprintf.h" |
#include "base/sys_byteorder.h" |
#include "build/build_config.h" |
+#include "net/http/http_status_code.h" |
#include "net/server/http_connection.h" |
#include "net/server/http_server_request_info.h" |
+#include "net/server/http_server_response_info.h" |
#include "net/server/web_socket.h" |
#include "net/socket/tcp_listen_socket.h" |
@@ -46,27 +48,27 @@ void HttpServer::SendOverWebSocket(int connection_id, |
} |
void HttpServer::Send(int connection_id, |
- HttpStatusCode status_code, |
- const std::string& data, |
- const std::string& content_type) { |
+ const HttpServerResponseInfo& response) { |
HttpConnection* connection = FindConnection(connection_id); |
if (connection == NULL) |
return; |
- connection->Send(status_code, data, content_type); |
+ connection->Send(response); |
} |
void HttpServer::Send200(int connection_id, |
const std::string& data, |
const std::string& content_type) { |
- Send(connection_id, HTTP_OK, data, content_type); |
+ HttpServerResponseInfo response(HTTP_OK); |
+ response.SetBody(data, content_type); |
+ Send(connection_id, response); |
} |
void HttpServer::Send404(int connection_id) { |
- Send(connection_id, HTTP_NOT_FOUND, std::string(), "text/html"); |
+ Send(connection_id, HttpServerResponseInfo::CreateFor404()); |
} |
void HttpServer::Send500(int connection_id, const std::string& message) { |
- Send(connection_id, HTTP_INTERNAL_SERVER_ERROR, message, "text/html"); |
+ Send(connection_id, HttpServerResponseInfo::CreateFor500(message)); |
} |
void HttpServer::Close(int connection_id) { |