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

Unified Diff: net/server/web_socket.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_server_response_info_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/server/web_socket.cc
diff --git a/net/server/web_socket.cc b/net/server/web_socket.cc
index df5b0ae073841cca75378b811a3503739b548273..746108548e69fd10b7ec7edcf03fe1341a69ff9c 100644
--- a/net/server/web_socket.cc
+++ b/net/server/web_socket.cc
@@ -16,6 +16,7 @@
#include "base/sys_byteorder.h"
#include "net/server/http_connection.h"
#include "net/server/http_server_request_info.h"
+#include "net/server/http_server_response_info.h"
namespace net {
@@ -115,18 +116,16 @@ class WebSocketHixie76 : public net::WebSocket {
std::string key2 = request.GetHeaderValue("Sec-WebSocket-Key2");
if (key1.empty()) {
- connection->Send(net::HTTP_INTERNAL_SERVER_ERROR,
- "Invalid request format. "
- "Sec-WebSocket-Key1 is empty or isn't specified.",
- "text/html");
+ connection->Send(HttpServerResponseInfo::CreateFor500(
+ "Invalid request format. Sec-WebSocket-Key1 is empty or isn't "
+ "specified."));
return;
}
if (key2.empty()) {
- connection->Send(net::HTTP_INTERNAL_SERVER_ERROR,
- "Invalid request format. "
- "Sec-WebSocket-Key2 is empty or isn't specified.",
- "text/html");
+ connection->Send(HttpServerResponseInfo::CreateFor500(
+ "Invalid request format. Sec-WebSocket-Key2 is empty or isn't "
+ "specified."));
return;
}
@@ -179,10 +178,9 @@ class WebSocketHybi17 : public WebSocket {
std::string key = request.GetHeaderValue("Sec-WebSocket-Key");
if (key.empty()) {
- connection->Send(net::HTTP_INTERNAL_SERVER_ERROR,
- "Invalid request format. "
- "Sec-WebSocket-Key is empty or isn't specified.",
- "text/html");
+ connection->Send(HttpServerResponseInfo::CreateFor500(
+ "Invalid request format. Sec-WebSocket-Key is empty or isn't "
+ "specified."));
return NULL;
}
return new WebSocketHybi17(connection, request, pos);
« no previous file with comments | « net/server/http_server_response_info_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698