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

Side by Side Diff: Source/modules/websockets/WebSocketHandshake.cpp

Issue 209823002: Remove cookieRequestHeaderFieldValue() and setCookie() call from WebSocketHandshake (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed #2 Created 6 years, 8 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 | « Source/modules/websockets/WebSocketHandshake.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 builder.append(" HTTP/1.1\r\n"); 202 builder.append(" HTTP/1.1\r\n");
203 203
204 Vector<String> fields; 204 Vector<String> fields;
205 fields.append("Upgrade: websocket"); 205 fields.append("Upgrade: websocket");
206 fields.append("Connection: Upgrade"); 206 fields.append("Connection: Upgrade");
207 fields.append("Host: " + hostName(m_url, m_secure)); 207 fields.append("Host: " + hostName(m_url, m_secure));
208 fields.append("Origin: " + clientOrigin()); 208 fields.append("Origin: " + clientOrigin());
209 if (!m_clientProtocol.isEmpty()) 209 if (!m_clientProtocol.isEmpty())
210 fields.append("Sec-WebSocket-Protocol: " + m_clientProtocol); 210 fields.append("Sec-WebSocket-Protocol: " + m_clientProtocol);
211 211
212 KURL url = httpURLForAuthenticationAndCookies();
213
214 String cookie = cookieRequestHeaderFieldValue(m_document, url);
215 if (!cookie.isEmpty())
216 fields.append("Cookie: " + cookie);
217 // Set "Cookie2: <cookie>" if cookies 2 exists for url?
218
219 // Add no-cache headers to avoid compatibility issue. 212 // Add no-cache headers to avoid compatibility issue.
220 // There are some proxies that rewrite "Connection: upgrade" 213 // There are some proxies that rewrite "Connection: upgrade"
221 // to "Connection: close" in the response if a request doesn't contain 214 // to "Connection: close" in the response if a request doesn't contain
222 // these headers. 215 // these headers.
223 fields.append("Pragma: no-cache"); 216 fields.append("Pragma: no-cache");
224 fields.append("Cache-Control: no-cache"); 217 fields.append("Cache-Control: no-cache");
225 218
226 fields.append("Sec-WebSocket-Key: " + m_secWebSocketKey); 219 fields.append("Sec-WebSocket-Key: " + m_secWebSocketKey);
227 fields.append("Sec-WebSocket-Version: 13"); 220 fields.append("Sec-WebSocket-Version: 13");
228 const String extensionValue = m_extensionDispatcher.createHeaderValue(); 221 const String extensionValue = m_extensionDispatcher.createHeaderValue();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 String WebSocketHandshake::failureReason() const 335 String WebSocketHandshake::failureReason() const
343 { 336 {
344 return m_failureReason; 337 return m_failureReason;
345 } 338 }
346 339
347 const AtomicString& WebSocketHandshake::serverWebSocketProtocol() const 340 const AtomicString& WebSocketHandshake::serverWebSocketProtocol() const
348 { 341 {
349 return m_response.headerFields().get("sec-websocket-protocol"); 342 return m_response.headerFields().get("sec-websocket-protocol");
350 } 343 }
351 344
352 const AtomicString& WebSocketHandshake::serverSetCookie() const
353 {
354 return m_response.headerFields().get("set-cookie");
355 }
356
357 const AtomicString& WebSocketHandshake::serverSetCookie2() const
358 {
359 return m_response.headerFields().get("set-cookie2");
360 }
361
362 const AtomicString& WebSocketHandshake::serverUpgrade() const 345 const AtomicString& WebSocketHandshake::serverUpgrade() const
363 { 346 {
364 return m_response.headerFields().get("upgrade"); 347 return m_response.headerFields().get("upgrade");
365 } 348 }
366 349
367 const AtomicString& WebSocketHandshake::serverConnection() const 350 const AtomicString& WebSocketHandshake::serverConnection() const
368 { 351 {
369 return m_response.headerFields().get("connection"); 352 return m_response.headerFields().get("connection");
370 } 353 }
371 354
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 560 }
578 if (!match) { 561 if (!match) {
579 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec- WebSocket-Protocol' header but no response was received"); 562 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec- WebSocket-Protocol' header but no response was received");
580 return false; 563 return false;
581 } 564 }
582 } 565 }
583 return true; 566 return true;
584 } 567 }
585 568
586 } // namespace WebCore 569 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/websockets/WebSocketHandshake.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698