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

Unified Diff: net/websockets/websocket_stream.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/url_request/url_request_job.cc ('k') | net/websockets/websocket_stream_cookie_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 002d51126c52ca13186f33408a54eae279e98659..b5012bc2883e4cdc4b2acb2d956cb78f1c79bdee 100644
--- a/net/websockets/websocket_stream.cc
+++ b/net/websockets/websocket_stream.cc
@@ -9,6 +9,7 @@
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
#include "base/profiler/scoped_tracker.h"
+#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "net/base/load_flags.h"
@@ -135,6 +136,20 @@ class StreamRequestImpl : public WebSocketStreamRequest {
connect_delegate_->OnSuccess(create_helper_->Upgrade());
}
+ std::string FailureMessageFromNetError() {
+ int error = url_request_->status().error();
+ if (error == ERR_TUNNEL_CONNECTION_FAILED) {
+ // This error is common and confusing, so special-case it.
+ // TODO(ricea): Include the HostPortPair of the selected proxy server in
+ // the error message. This is not currently possible because it isn't set
+ // in HttpResponseInfo when a ERR_TUNNEL_CONNECTION_FAILED error happens.
+ return "Establishing a tunnel via proxy server failed.";
+ } else {
+ return std::string("Error in connection establishment: ") +
+ ErrorToString(url_request_->status().error());
+ }
+ }
+
void ReportFailure() {
DCHECK(timer_);
timer_->Stop();
@@ -150,9 +165,7 @@ class StreamRequestImpl : public WebSocketStreamRequest {
failure_message_ = "WebSocket opening handshake was canceled";
break;
case URLRequestStatus::FAILED:
- failure_message_ =
- std::string("Error in connection establishment: ") +
- ErrorToString(url_request_->status().error());
+ failure_message_ = FailureMessageFromNetError();
break;
}
}
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | net/websockets/websocket_stream_cookie_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698