Chromium Code Reviews| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 String WebSocketHandshake::getExpectedWebSocketAccept(const String& secWebSocket Key) | 119 String WebSocketHandshake::getExpectedWebSocketAccept(const String& secWebSocket Key) |
| 120 { | 120 { |
| 121 static const char webSocketKeyGUID[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11 "; | 121 static const char webSocketKeyGUID[] = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11 "; |
| 122 CString keyData = secWebSocketKey.ascii(); | 122 CString keyData = secWebSocketKey.ascii(); |
| 123 | 123 |
| 124 StringBuilder digestable; | 124 StringBuilder digestable; |
| 125 digestable.append(secWebSocketKey); | 125 digestable.append(secWebSocketKey); |
| 126 digestable.append(webSocketKeyGUID, strlen(webSocketKeyGUID)); | 126 digestable.append(webSocketKeyGUID, strlen(webSocketKeyGUID)); |
| 127 CString digestableCString = digestable.toString().utf8(); | 127 CString digestableCString = digestable.toString().utf8(); |
| 128 DigestValue digest; | 128 DigestValue digest; |
| 129 computeDigest(HashAlgorithmSha1, digestableCString.data(), digestableCString .length(), digest); | 129 bool digestSuccess = computeDigest(HashAlgorithmSha1, digestableCString.data (), digestableCString.length(), digest); |
| 130 ASSERT_WITH_SECURITY_IMPLICATION(digestSuccess); | |
|
abarth-chromium
2014/04/11 23:26:20
Why not just RELEASE_ASSERT ?
| |
| 130 | 131 |
| 131 return base64Encode(reinterpret_cast<const char*>(digest.data()), sha1HashSi ze); | 132 return base64Encode(reinterpret_cast<const char*>(digest.data()), sha1HashSi ze); |
| 132 } | 133 } |
| 133 | 134 |
| 134 WebSocketHandshake::WebSocketHandshake(const KURL& url, const String& protocol, Document* document) | 135 WebSocketHandshake::WebSocketHandshake(const KURL& url, const String& protocol, Document* document) |
| 135 : m_url(url) | 136 : m_url(url) |
| 136 , m_clientProtocol(protocol) | 137 , m_clientProtocol(protocol) |
| 137 , m_secure(m_url.protocolIs("wss")) | 138 , m_secure(m_url.protocolIs("wss")) |
| 138 , m_document(document) | 139 , m_document(document) |
| 139 , m_mode(Incomplete) | 140 , m_mode(Incomplete) |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 562 } | 563 } |
| 563 if (!match) { | 564 if (!match) { |
| 564 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec- WebSocket-Protocol' header but no response was received"); | 565 m_failureReason = formatHandshakeFailureReason("Sent non-empty 'Sec- WebSocket-Protocol' header but no response was received"); |
| 565 return false; | 566 return false; |
| 566 } | 567 } |
| 567 } | 568 } |
| 568 return true; | 569 return true; |
| 569 } | 570 } |
| 570 | 571 |
| 571 } // namespace WebCore | 572 } // namespace WebCore |
| OLD | NEW |