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