| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_basic_handshake_stream.h" | 5 #include "net/websockets/websocket_basic_handshake_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 std::string* failure_message) { | 127 std::string* failure_message) { |
| 128 std::string value; | 128 std::string value; |
| 129 GetHeaderResult result = | 129 GetHeaderResult result = |
| 130 GetSingleHeaderValue(headers, websockets::kUpgrade, &value); | 130 GetSingleHeaderValue(headers, websockets::kUpgrade, &value); |
| 131 if (!ValidateHeaderHasSingleValue(result, | 131 if (!ValidateHeaderHasSingleValue(result, |
| 132 websockets::kUpgrade, | 132 websockets::kUpgrade, |
| 133 failure_message)) { | 133 failure_message)) { |
| 134 return false; | 134 return false; |
| 135 } | 135 } |
| 136 | 136 |
| 137 if (!LowerCaseEqualsASCII(value, websockets::kWebSocketLowercase)) { | 137 if (!base::LowerCaseEqualsASCII(value, websockets::kWebSocketLowercase)) { |
| 138 *failure_message = | 138 *failure_message = |
| 139 "'Upgrade' header value is not 'WebSocket': " + value; | 139 "'Upgrade' header value is not 'WebSocket': " + value; |
| 140 return false; | 140 return false; |
| 141 } | 141 } |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool ValidateSecWebSocketAccept(const HttpResponseHeaders* headers, | 145 bool ValidateSecWebSocketAccept(const HttpResponseHeaders* headers, |
| 146 const std::string& expected, | 146 const std::string& expected, |
| 147 std::string* failure_message) { | 147 std::string* failure_message) { |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 set_failure_message("Error during WebSocket handshake: " + failure_message); | 618 set_failure_message("Error during WebSocket handshake: " + failure_message); |
| 619 return ERR_INVALID_RESPONSE; | 619 return ERR_INVALID_RESPONSE; |
| 620 } | 620 } |
| 621 | 621 |
| 622 void WebSocketBasicHandshakeStream::set_failure_message( | 622 void WebSocketBasicHandshakeStream::set_failure_message( |
| 623 const std::string& failure_message) { | 623 const std::string& failure_message) { |
| 624 *failure_message_ = failure_message; | 624 *failure_message_ = failure_message; |
| 625 } | 625 } |
| 626 | 626 |
| 627 } // namespace net | 627 } // namespace net |
| OLD | NEW |