Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: net/server/http_connection.cc

Issue 19637005: Allow HttpServer response to include custom headers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, add back original Send method Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/server/http_connection.h ('k') | net/server/http_server.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/server/http_connection.cc
diff --git a/net/server/http_connection.cc b/net/server/http_connection.cc
index 66541faa37354aaec22ba81059f9e7856b7891b0..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,22 +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;
-
- 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,
- GetHttpReasonPhrase(status_code),
- 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)
« no previous file with comments | « net/server/http_connection.h ('k') | net/server/http_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698