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

Unified Diff: net/websockets/websocket_stream.cc

Issue 336263005: Map WebSocket URL schemes to HTTP URL schemes for auth purposes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused file. Created 6 years, 6 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/tools/testserver/testserver.py ('k') | net/websockets/websocket_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_stream.cc
diff --git a/net/websockets/websocket_stream.cc b/net/websockets/websocket_stream.cc
index 304edc75c9a8bb31a16dcc2c1d72993c2f2e5e3e..dac1814981138e6bd22c79e7714fd4218df43d22 100644
--- a/net/websockets/websocket_stream.cc
+++ b/net/websockets/websocket_stream.cc
@@ -10,6 +10,7 @@
#include "base/metrics/sparse_histogram.h"
#include "net/base/load_flags.h"
#include "net/http/http_request_headers.h"
+#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
@@ -135,9 +136,25 @@ class StreamRequestImpl : public WebSocketStreamRequest {
break;
}
}
+ ReportFailureWithMessage(failure_message);
+ }
+
+ void ReportFailureWithMessage(const std::string& failure_message) {
connect_delegate_->OnFailure(failure_message);
}
+ void OnFinishOpeningHandshake() {
tyoshino (SeeGerritForStatus) 2014/07/07 19:26:44 this looks similar to WebSocketBasicHandshakeStrea
Adam Rice 2014/07/08 10:23:45 Yes. Factored out in a separate function used by b
+ HttpResponseHeaders* headers = url_request_.response_headers();
+ if (headers) {
+ connect_delegate_->OnFinishOpeningHandshake(make_scoped_ptr(
+ new WebSocketHandshakeResponseInfo(url_request_.url(),
+ headers->response_code(),
+ headers->GetStatusText(),
+ headers,
+ url_request_.response_time())));
+ }
+ }
+
WebSocketStream::ConnectDelegate* connect_delegate() const {
return connect_delegate_.get();
}
@@ -197,7 +214,16 @@ void Delegate::OnResponseStarted(URLRequest* request) {
return;
case HTTP_UNAUTHORIZED:
+ result_ = FAILED;
+ owner_->OnFinishOpeningHandshake();
+ owner_->ReportFailureWithMessage(
+ "HTTP Authentication failed; no valid credentials available");
+ return;
+
case HTTP_PROXY_AUTHENTICATION_REQUIRED:
+ result_ = FAILED;
+ owner_->OnFinishOpeningHandshake();
+ owner_->ReportFailureWithMessage("Proxy authentication failed");
return;
default:
« no previous file with comments | « net/tools/testserver/testserver.py ('k') | net/websockets/websocket_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698