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

Side by Side Diff: net/websockets/websocket_handshake_stream_base.h

Issue 105833003: Fail WebSocket channel when handshake fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_
6 #define NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ 6 #define NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_
7 7
8 // This file is included from net/http files. 8 // This file is included from net/http files.
9 // Since net/http can be built without linking net/websockets code, 9 // Since net/http can be built without linking net/websockets code,
10 // this file must not introduce any link-time dependencies on websockets. 10 // this file must not introduce any link-time dependencies on websockets.
11 11
12 #include <string>
13
12 #include "base/basictypes.h" 14 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
15 #include "base/supports_user_data.h" 17 #include "base/supports_user_data.h"
16 #include "net/http/http_stream_base.h" 18 #include "net/http/http_stream_base.h"
17 #include "net/url_request/websocket_handshake_userdata_key.h" 19 #include "net/url_request/websocket_handshake_userdata_key.h"
18 #include "net/websockets/websocket_stream.h" 20 #include "net/websockets/websocket_stream.h"
19 21
20 namespace net { 22 namespace net {
21 23
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // This has to have an inline implementation so that the net/url_request/ 59 // This has to have an inline implementation so that the net/url_request/
58 // tests do not fail on iOS. 60 // tests do not fail on iOS.
59 virtual ~WebSocketHandshakeStreamBase() {} 61 virtual ~WebSocketHandshakeStreamBase() {}
60 62
61 // After the handshake has completed, this method creates a WebSocketStream 63 // After the handshake has completed, this method creates a WebSocketStream
62 // (of the appropriate type) from the WebSocketHandshakeStreamBase object. 64 // (of the appropriate type) from the WebSocketHandshakeStreamBase object.
63 // The WebSocketHandshakeStreamBase object is unusable after Upgrade() has 65 // The WebSocketHandshakeStreamBase object is unusable after Upgrade() has
64 // been called. 66 // been called.
65 virtual scoped_ptr<WebSocketStream> Upgrade() = 0; 67 virtual scoped_ptr<WebSocketStream> Upgrade() = 0;
66 68
69 // Returns a string describing the connection failure information.
70 // Returns an empty string if there is no failure.
71 virtual std::string FailureMessage() const = 0;
szym 2013/12/09 18:49:58 By convention this should be GetFailureMessage()
yhirano 2013/12/10 03:30:09 Done.
72
67 protected: 73 protected:
68 // As with the destructor, this must be inline. 74 // As with the destructor, this must be inline.
69 WebSocketHandshakeStreamBase() {} 75 WebSocketHandshakeStreamBase() {}
70 76
71 private: 77 private:
72 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeStreamBase); 78 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeStreamBase);
73 }; 79 };
74 80
75 } // namespace net 81 } // namespace net
76 82
77 #endif // NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ 83 #endif // NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698