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

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

Issue 10843050: WebSocket over SPDY: handshake support for both of SPDY/2 and SPDY/3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase for landing Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/net.gyp ('k') | net/websockets/websocket_handshake_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // WebSocketHandshake*Handler handles WebSocket handshake request message 5 // WebSocketHandshake*Handler handles WebSocket handshake request message
6 // from WebKit renderer process, and WebSocket handshake response message 6 // from WebKit renderer process, and WebSocket handshake response message
7 // from WebSocket server. 7 // from WebSocket server.
8 // It modifies messages for the following reason: 8 // It modifies messages for the following reason:
9 // - We don't trust WebKit renderer process, so we'll not expose HttpOnly 9 // - We don't trust WebKit renderer process, so we'll not expose HttpOnly
10 // cookies to the renderer process, so handles HttpOnly cookies in 10 // cookies to the renderer process, so handles HttpOnly cookies in
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // Gets request info to open WebSocket connection. 62 // Gets request info to open WebSocket connection.
63 // Fills challange data (concatenation of key1, 2 and 3 for hybi-03 and 63 // Fills challange data (concatenation of key1, 2 and 3 for hybi-03 and
64 // earlier, or Sec-WebSocket-Key header value for hybi-04 and later) 64 // earlier, or Sec-WebSocket-Key header value for hybi-04 and later)
65 // in |challenge|. 65 // in |challenge|.
66 HttpRequestInfo GetRequestInfo(const GURL& url, std::string* challenge); 66 HttpRequestInfo GetRequestInfo(const GURL& url, std::string* challenge);
67 // Gets request as SpdyHeaderBlock. 67 // Gets request as SpdyHeaderBlock.
68 // Also, fills challenge data in |challenge|. 68 // Also, fills challenge data in |challenge|.
69 bool GetRequestHeaderBlock(const GURL& url, 69 bool GetRequestHeaderBlock(const GURL& url,
70 SpdyHeaderBlock* headers, 70 SpdyHeaderBlock* headers,
71 std::string* challenge); 71 std::string* challenge,
72 int spdy_protocol_version);
72 // Gets WebSocket handshake raw request message to open WebSocket 73 // Gets WebSocket handshake raw request message to open WebSocket
73 // connection. 74 // connection.
74 std::string GetRawRequest(); 75 std::string GetRawRequest();
75 // Calling raw_length is valid only after GetRawRquest() call. 76 // Calling raw_length is valid only after GetRawRquest() call.
76 size_t raw_length() const; 77 size_t raw_length() const;
77 78
78 // Returns the value of Sec-WebSocket-Version or Sec-WebSocket-Draft header 79 // Returns the value of Sec-WebSocket-Version or Sec-WebSocket-Draft header
79 // (the latter is an old name of the former). Returns 0 if both headers were 80 // (the latter is an old name of the former). Returns 0 if both headers were
80 // absent, which means the handshake was based on hybi-00 (= hixie-76). 81 // absent, which means the handshake was based on hybi-00 (= hixie-76).
81 // Should only be called after the handshake has been parsed. 82 // Should only be called after the handshake has been parsed.
(...skipping 28 matching lines...) Expand all
110 // after handshake response message. 111 // after handshake response message.
111 // TODO(ukai): fail fast when response gives wrong status code. 112 // TODO(ukai): fail fast when response gives wrong status code.
112 size_t ParseRawResponse(const char* data, int length); 113 size_t ParseRawResponse(const char* data, int length);
113 // Returns true if it already parses full handshake response message. 114 // Returns true if it already parses full handshake response message.
114 bool HasResponse() const; 115 bool HasResponse() const;
115 // Parses WebSocket handshake response info given as HttpResponseInfo. 116 // Parses WebSocket handshake response info given as HttpResponseInfo.
116 bool ParseResponseInfo(const HttpResponseInfo& response_info, 117 bool ParseResponseInfo(const HttpResponseInfo& response_info,
117 const std::string& challenge); 118 const std::string& challenge);
118 // Parses WebSocket handshake response as SpdyHeaderBlock. 119 // Parses WebSocket handshake response as SpdyHeaderBlock.
119 bool ParseResponseHeaderBlock(const SpdyHeaderBlock& headers, 120 bool ParseResponseHeaderBlock(const SpdyHeaderBlock& headers,
120 const std::string& challenge); 121 const std::string& challenge,
122 int spdy_protocol_version);
121 123
122 // Gets the headers value. 124 // Gets the headers value.
123 void GetHeaders(const char* const headers_to_get[], 125 void GetHeaders(const char* const headers_to_get[],
124 size_t headers_to_get_len, 126 size_t headers_to_get_len,
125 std::vector<std::string>* values); 127 std::vector<std::string>* values);
126 // Removes the headers that matches (case insensitive). 128 // Removes the headers that matches (case insensitive).
127 void RemoveHeaders(const char* const headers_to_remove[], 129 void RemoveHeaders(const char* const headers_to_remove[],
128 size_t headers_to_remove_len); 130 size_t headers_to_remove_len);
129 131
130 // Gets raw WebSocket handshake response received from WebSocket server. 132 // Gets raw WebSocket handshake response received from WebSocket server.
(...skipping 15 matching lines...) Expand all
146 std::string header_separator_; 148 std::string header_separator_;
147 std::string key_; 149 std::string key_;
148 int protocol_version_; 150 int protocol_version_;
149 151
150 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeResponseHandler); 152 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeResponseHandler);
151 }; 153 };
152 154
153 } // namespace net 155 } // namespace net
154 156
155 #endif // NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_ 157 #endif // NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/websockets/websocket_handshake_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698