| 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/sha1.h" | 10 #include "base/sha1.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 iter.name_end(), | 263 iter.name_end(), |
| 264 websockets::kSecWebSocketProtocolLowercase) || | 264 websockets::kSecWebSocketProtocolLowercase) || |
| 265 LowerCaseEqualsASCII( | 265 LowerCaseEqualsASCII( |
| 266 iter.name_begin(), | 266 iter.name_begin(), |
| 267 iter.name_end(), | 267 iter.name_end(), |
| 268 websockets::kSecWebSocketExtensionsLowercase)) { | 268 websockets::kSecWebSocketExtensionsLowercase)) { |
| 269 // TODO(toyoshim): Some WebSocket extensions may not be compatible with | 269 // TODO(toyoshim): Some WebSocket extensions may not be compatible with |
| 270 // SPDY. We should omit them from a Sec-WebSocket-Extension header. | 270 // SPDY. We should omit them from a Sec-WebSocket-Extension header. |
| 271 std::string name; | 271 std::string name; |
| 272 if (spdy_protocol_version <= 2) | 272 if (spdy_protocol_version <= 2) |
| 273 name = StringToLowerASCII(iter.name()); | 273 name = base::StringToLowerASCII(iter.name()); |
| 274 else | 274 else |
| 275 name = ":" + StringToLowerASCII(iter.name()); | 275 name = ":" + base::StringToLowerASCII(iter.name()); |
| 276 (*headers)[name] = iter.values(); | 276 (*headers)[name] = iter.values(); |
| 277 continue; | 277 continue; |
| 278 } | 278 } |
| 279 // Others should be sent out to |headers|. | 279 // Others should be sent out to |headers|. |
| 280 std::string name = StringToLowerASCII(iter.name()); | 280 std::string name = base::StringToLowerASCII(iter.name()); |
| 281 SpdyHeaderBlock::iterator found = headers->find(name); | 281 SpdyHeaderBlock::iterator found = headers->find(name); |
| 282 if (found == headers->end()) { | 282 if (found == headers->end()) { |
| 283 (*headers)[name] = iter.values(); | 283 (*headers)[name] = iter.values(); |
| 284 } else { | 284 } else { |
| 285 // For now, websocket doesn't use multiple headers, but follows to http. | 285 // For now, websocket doesn't use multiple headers, but follows to http. |
| 286 found->second.append(1, '\0'); // +=() doesn't append 0's | 286 found->second.append(1, '\0'); // +=() doesn't append 0's |
| 287 found->second.append(iter.values()); | 287 found->second.append(iter.values()); |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 | 290 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 489 |
| 490 std::string WebSocketHandshakeResponseHandler::GetResponse() { | 490 std::string WebSocketHandshakeResponseHandler::GetResponse() { |
| 491 DCHECK(HasResponse()); | 491 DCHECK(HasResponse()); |
| 492 DCHECK(!status_line_.empty()); | 492 DCHECK(!status_line_.empty()); |
| 493 // headers_ might be empty for wrong response from server. | 493 // headers_ might be empty for wrong response from server. |
| 494 | 494 |
| 495 return status_line_ + headers_ + header_separator_; | 495 return status_line_ + headers_ + header_separator_; |
| 496 } | 496 } |
| 497 | 497 |
| 498 } // namespace net | 498 } // namespace net |
| OLD | NEW |