| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "config.h" | 32 #include "config.h" |
| 33 | 33 |
| 34 #include "modules/websockets/WebSocketHandshake.h" | 34 #include "modules/websockets/WebSocketHandshake.h" |
| 35 | 35 |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
| 38 #include "core/inspector/ScriptCallStack.h" | 38 #include "core/inspector/ScriptCallStack.h" |
| 39 #include "core/loader/CookieJar.h" | 39 #include "core/loader/CookieJar.h" |
| 40 #include "core/platform/Cookie.h" | 40 #include "core/platform/Cookie.h" |
| 41 #include "core/platform/HistogramSupport.h" | |
| 42 #include "modules/websockets/WebSocket.h" | 41 #include "modules/websockets/WebSocket.h" |
| 43 #include "platform/Logging.h" | 42 #include "platform/Logging.h" |
| 44 #include "platform/network/HTTPHeaderMap.h" | 43 #include "platform/network/HTTPHeaderMap.h" |
| 45 #include "platform/network/HTTPParsers.h" | 44 #include "platform/network/HTTPParsers.h" |
| 45 #include "public/platform/Platform.h" |
| 46 #include "weborigin/KURL.h" | 46 #include "weborigin/KURL.h" |
| 47 #include "weborigin/SecurityOrigin.h" | 47 #include "weborigin/SecurityOrigin.h" |
| 48 #include "wtf/CryptographicallyRandomNumber.h" | 48 #include "wtf/CryptographicallyRandomNumber.h" |
| 49 #include "wtf/SHA1.h" | 49 #include "wtf/SHA1.h" |
| 50 #include "wtf/StdLibExtras.h" | 50 #include "wtf/StdLibExtras.h" |
| 51 #include "wtf/StringExtras.h" | 51 #include "wtf/StringExtras.h" |
| 52 #include "wtf/Vector.h" | 52 #include "wtf/Vector.h" |
| 53 #include "wtf/text/Base64.h" | 53 #include "wtf/text/Base64.h" |
| 54 #include "wtf/text/CString.h" | 54 #include "wtf/text/CString.h" |
| 55 #include "wtf/text/StringBuilder.h" | 55 #include "wtf/text/StringBuilder.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 , m_secure(m_url.protocolIs("wss")) | 141 , m_secure(m_url.protocolIs("wss")) |
| 142 , m_context(context) | 142 , m_context(context) |
| 143 , m_mode(Incomplete) | 143 , m_mode(Incomplete) |
| 144 { | 144 { |
| 145 m_secWebSocketKey = generateSecWebSocketKey(); | 145 m_secWebSocketKey = generateSecWebSocketKey(); |
| 146 m_expectedAccept = getExpectedWebSocketAccept(m_secWebSocketKey); | 146 m_expectedAccept = getExpectedWebSocketAccept(m_secWebSocketKey); |
| 147 } | 147 } |
| 148 | 148 |
| 149 WebSocketHandshake::~WebSocketHandshake() | 149 WebSocketHandshake::~WebSocketHandshake() |
| 150 { | 150 { |
| 151 HistogramSupport::histogramEnumeration("WebCore.WebSocket.HandshakeResult",
m_mode, WebSocketHandshake::ModeMax); | 151 WebKit::Platform::current()->histogramEnumeration("WebCore.WebSocket.Handsha
keResult", m_mode, WebSocketHandshake::ModeMax); |
| 152 } | 152 } |
| 153 | 153 |
| 154 const KURL& WebSocketHandshake::url() const | 154 const KURL& WebSocketHandshake::url() const |
| 155 { | 155 { |
| 156 return m_url; | 156 return m_url; |
| 157 } | 157 } |
| 158 | 158 |
| 159 void WebSocketHandshake::setURL(const KURL& url) | 159 void WebSocketHandshake::setURL(const KURL& url) |
| 160 { | 160 { |
| 161 m_url = url.copy(); | 161 m_url = url.copy(); |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 } | 585 } |
| 586 if (!match) { | 586 if (!match) { |
| 587 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec-
WebSocket-Protocol' header but no response is received"); | 587 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec-
WebSocket-Protocol' header but no response is received"); |
| 588 return false; | 588 return false; |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 return true; | 591 return true; |
| 592 } | 592 } |
| 593 | 593 |
| 594 } // namespace WebCore | 594 } // namespace WebCore |
| OLD | NEW |