| 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 12 matching lines...) Expand all Loading... |
| 23 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
| 24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 25 #include "crypto/random.h" | 25 #include "crypto/random.h" |
| 26 #include "net/http/http_request_headers.h" | 26 #include "net/http/http_request_headers.h" |
| 27 #include "net/http/http_request_info.h" | 27 #include "net/http/http_request_info.h" |
| 28 #include "net/http/http_response_body_drainer.h" | 28 #include "net/http/http_response_body_drainer.h" |
| 29 #include "net/http/http_response_headers.h" | 29 #include "net/http/http_response_headers.h" |
| 30 #include "net/http/http_status_code.h" | 30 #include "net/http/http_status_code.h" |
| 31 #include "net/http/http_stream_parser.h" | 31 #include "net/http/http_stream_parser.h" |
| 32 #include "net/socket/client_socket_handle.h" | 32 #include "net/socket/client_socket_handle.h" |
| 33 #include "net/socket/websocket_transport_client_socket_pool.h" |
| 33 #include "net/websockets/websocket_basic_stream.h" | 34 #include "net/websockets/websocket_basic_stream.h" |
| 34 #include "net/websockets/websocket_deflate_predictor.h" | 35 #include "net/websockets/websocket_deflate_predictor.h" |
| 35 #include "net/websockets/websocket_deflate_predictor_impl.h" | 36 #include "net/websockets/websocket_deflate_predictor_impl.h" |
| 36 #include "net/websockets/websocket_deflate_stream.h" | 37 #include "net/websockets/websocket_deflate_stream.h" |
| 37 #include "net/websockets/websocket_deflater.h" | 38 #include "net/websockets/websocket_deflater.h" |
| 38 #include "net/websockets/websocket_extension_parser.h" | 39 #include "net/websockets/websocket_extension_parser.h" |
| 39 #include "net/websockets/websocket_handshake_constants.h" | 40 #include "net/websockets/websocket_handshake_constants.h" |
| 40 #include "net/websockets/websocket_handshake_handler.h" | 41 #include "net/websockets/websocket_handshake_handler.h" |
| 41 #include "net/websockets/websocket_handshake_request_info.h" | 42 #include "net/websockets/websocket_handshake_request_info.h" |
| 42 #include "net/websockets/websocket_handshake_response_info.h" | 43 #include "net/websockets/websocket_handshake_response_info.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 490 |
| 490 void WebSocketBasicHandshakeStream::SetPriority(RequestPriority priority) { | 491 void WebSocketBasicHandshakeStream::SetPriority(RequestPriority priority) { |
| 491 // TODO(ricea): See TODO comment in HttpBasicStream::SetPriority(). If it is | 492 // TODO(ricea): See TODO comment in HttpBasicStream::SetPriority(). If it is |
| 492 // gone, then copy whatever has happened there over here. | 493 // gone, then copy whatever has happened there over here. |
| 493 } | 494 } |
| 494 | 495 |
| 495 scoped_ptr<WebSocketStream> WebSocketBasicHandshakeStream::Upgrade() { | 496 scoped_ptr<WebSocketStream> WebSocketBasicHandshakeStream::Upgrade() { |
| 496 // The HttpStreamParser object has a pointer to our ClientSocketHandle. Make | 497 // The HttpStreamParser object has a pointer to our ClientSocketHandle. Make |
| 497 // sure it does not touch it again before it is destroyed. | 498 // sure it does not touch it again before it is destroyed. |
| 498 state_.DeleteParser(); | 499 state_.DeleteParser(); |
| 500 WebSocketTransportClientSocketPool::UnlockEndpoint(state_.connection()); |
| 499 scoped_ptr<WebSocketStream> basic_stream( | 501 scoped_ptr<WebSocketStream> basic_stream( |
| 500 new WebSocketBasicStream(state_.ReleaseConnection(), | 502 new WebSocketBasicStream(state_.ReleaseConnection(), |
| 501 state_.read_buf(), | 503 state_.read_buf(), |
| 502 sub_protocol_, | 504 sub_protocol_, |
| 503 extensions_)); | 505 extensions_)); |
| 504 DCHECK(extension_params_.get()); | 506 DCHECK(extension_params_.get()); |
| 505 if (extension_params_->deflate_enabled) { | 507 if (extension_params_->deflate_enabled) { |
| 506 UMA_HISTOGRAM_ENUMERATION( | 508 UMA_HISTOGRAM_ENUMERATION( |
| 507 "Net.WebSocket.DeflateMode", | 509 "Net.WebSocket.DeflateMode", |
| 508 extension_params_->deflate_mode, | 510 extension_params_->deflate_mode, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 &extensions_, | 620 &extensions_, |
| 619 &failure_message_, | 621 &failure_message_, |
| 620 extension_params_.get())) { | 622 extension_params_.get())) { |
| 621 return OK; | 623 return OK; |
| 622 } | 624 } |
| 623 failure_message_ = "Error during WebSocket handshake: " + failure_message_; | 625 failure_message_ = "Error during WebSocket handshake: " + failure_message_; |
| 624 return ERR_INVALID_RESPONSE; | 626 return ERR_INVALID_RESPONSE; |
| 625 } | 627 } |
| 626 | 628 |
| 627 } // namespace net | 629 } // namespace net |
| OLD | NEW |