| OLD | NEW |
| 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 #include "net/websockets/websocket_handshake_handler.h" | 5 #include "net/websockets/websocket_handshake_handler.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/md5.h" | 10 #include "base/md5.h" |
| 11 #include "base/sha1.h" | 11 #include "base/sha1.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_piece.h" |
| 14 #include "base/strings/string_tokenizer.h" |
| 13 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 14 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 15 #include "base/strings/string_piece.h" | |
| 16 #include "base/strings/string_tokenizer.h" | |
| 17 #include "googleurl/src/gurl.h" | |
| 18 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 19 #include "net/http/http_util.h" | 18 #include "net/http/http_util.h" |
| 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 const size_t kRequestKey3Size = 8U; | 23 const size_t kRequestKey3Size = 8U; |
| 24 const size_t kResponseKeySize = 16U; | 24 const size_t kResponseKeySize = 16U; |
| 25 | 25 |
| 26 // First version that introduced new WebSocket handshake which does not | 26 // First version that introduced new WebSocket handshake which does not |
| 27 // require sending "key3" or "response key" data after headers. | 27 // require sending "key3" or "response key" data after headers. |
| 28 const int kMinVersionOfHybiNewHandshake = 4; | 28 const int kMinVersionOfHybiNewHandshake = 4; |
| 29 | 29 |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 return status_line_ + headers_ + header_separator_ + key_; | 564 return status_line_ + headers_ + header_separator_ + key_; |
| 565 } | 565 } |
| 566 | 566 |
| 567 size_t WebSocketHandshakeResponseHandler::GetResponseKeySize() const { | 567 size_t WebSocketHandshakeResponseHandler::GetResponseKeySize() const { |
| 568 if (protocol_version_ >= kMinVersionOfHybiNewHandshake) | 568 if (protocol_version_ >= kMinVersionOfHybiNewHandshake) |
| 569 return 0; | 569 return 0; |
| 570 return kResponseKeySize; | 570 return kResponseKeySize; |
| 571 } | 571 } |
| 572 | 572 |
| 573 } // namespace net | 573 } // namespace net |
| OLD | NEW |