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

Unified Diff: net/websockets/websocket_stream.cc

Issue 105833003: Fail WebSocket channel when handshake fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 11 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
Index: net/websockets/websocket_stream.cc
diff --git a/net/websockets/websocket_stream.cc b/net/websockets/websocket_stream.cc
index e81c24e706e702c83d152bd5671f75c27b90d78b..f40da4da2fd7ed13d01b1414c374b89c6bb4db54 100644
--- a/net/websockets/websocket_stream.cc
+++ b/net/websockets/websocket_stream.cc
@@ -70,7 +70,20 @@ class StreamRequestImpl : public WebSocketStreamRequest {
}
void ReportFailure() {
- connect_delegate_->OnFailure(kWebSocketErrorAbnormalClosure);
+ std::string failure_message;
+ if (create_helper_->stream()) {
+ failure_message = create_helper_->stream()->GetFailureMessage();
+ } else {
+ const URLRequestStatus& status = url_request_.status();
+ if (status.status() == URLRequestStatus::CANCELED) {
tyoshino (SeeGerritForStatus) 2014/01/09 04:08:48 use switch?
yhirano 2014/01/09 05:24:51 Done.
+ failure_message = "WebSocket opening handshake was canceled";
+ } else if (status.status() == URLRequestStatus::FAILED) {
+ failure_message =
+ std::string("Error in connection establishment: ") +
+ ErrorToString(status.error());
+ }
+ }
+ connect_delegate_->OnFailure(failure_message);
}
private:

Powered by Google App Engine
This is Rietveld 408576698