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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 std::string* failure_message) { | 135 std::string* failure_message) { |
136 std::string value; | 136 std::string value; |
137 GetHeaderResult result = | 137 GetHeaderResult result = |
138 GetSingleHeaderValue(headers, websockets::kUpgrade, &value); | 138 GetSingleHeaderValue(headers, websockets::kUpgrade, &value); |
139 if (!ValidateHeaderHasSingleValue(result, | 139 if (!ValidateHeaderHasSingleValue(result, |
140 websockets::kUpgrade, | 140 websockets::kUpgrade, |
141 failure_message)) { | 141 failure_message)) { |
142 return false; | 142 return false; |
143 } | 143 } |
144 | 144 |
145 if (!LowerCaseEqualsASCII(value, websockets::kWebSocketLowercase)) { | 145 if (!base::LowerCaseEqualsASCII(value, websockets::kWebSocketLowercase)) { |
146 *failure_message = | 146 *failure_message = |
147 "'Upgrade' header value is not 'WebSocket': " + value; | 147 "'Upgrade' header value is not 'WebSocket': " + value; |
148 return false; | 148 return false; |
149 } | 149 } |
150 return true; | 150 return true; |
151 } | 151 } |
152 | 152 |
153 bool ValidateSecWebSocketAccept(const HttpResponseHeaders* headers, | 153 bool ValidateSecWebSocketAccept(const HttpResponseHeaders* headers, |
154 const std::string& expected, | 154 const std::string& expected, |
155 std::string* failure_message) { | 155 std::string* failure_message) { |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 set_failure_message("Error during WebSocket handshake: " + failure_message); | 647 set_failure_message("Error during WebSocket handshake: " + failure_message); |
648 return ERR_INVALID_RESPONSE; | 648 return ERR_INVALID_RESPONSE; |
649 } | 649 } |
650 | 650 |
651 void WebSocketBasicHandshakeStream::set_failure_message( | 651 void WebSocketBasicHandshakeStream::set_failure_message( |
652 const std::string& failure_message) { | 652 const std::string& failure_message) { |
653 *failure_message_ = failure_message; | 653 *failure_message_ = failure_message; |
654 } | 654 } |
655 | 655 |
656 } // namespace net | 656 } // namespace net |
OLD | NEW |