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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/base64.h" | 13 #include "base/base64.h" |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/metrics/histogram.h" |
17 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_piece.h" | 20 #include "base/strings/string_piece.h" |
20 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
21 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
22 #include "base/time/time.h" | 23 #include "base/time/time.h" |
23 #include "crypto/random.h" | 24 #include "crypto/random.h" |
24 #include "net/http/http_request_headers.h" | 25 #include "net/http/http_request_headers.h" |
25 #include "net/http/http_request_info.h" | 26 #include "net/http/http_request_info.h" |
26 #include "net/http/http_response_body_drainer.h" | 27 #include "net/http/http_response_body_drainer.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 // The HttpStreamParser object has a pointer to our ClientSocketHandle. Make | 499 // The HttpStreamParser object has a pointer to our ClientSocketHandle. Make |
499 // sure it does not touch it again before it is destroyed. | 500 // sure it does not touch it again before it is destroyed. |
500 state_.DeleteParser(); | 501 state_.DeleteParser(); |
501 scoped_ptr<WebSocketStream> basic_stream( | 502 scoped_ptr<WebSocketStream> basic_stream( |
502 new WebSocketBasicStream(state_.ReleaseConnection(), | 503 new WebSocketBasicStream(state_.ReleaseConnection(), |
503 state_.read_buf(), | 504 state_.read_buf(), |
504 sub_protocol_, | 505 sub_protocol_, |
505 extensions_)); | 506 extensions_)); |
506 DCHECK(extension_params_.get()); | 507 DCHECK(extension_params_.get()); |
507 if (extension_params_->deflate_enabled) { | 508 if (extension_params_->deflate_enabled) { |
| 509 UMA_HISTOGRAM_ENUMERATION( |
| 510 "Net.WebSocket.DeflateMode", |
| 511 extension_params_->deflate_mode, |
| 512 WebSocketDeflater::NUM_CONTEXT_TAKEOVER_MODE_TYPES); |
| 513 |
508 return scoped_ptr<WebSocketStream>( | 514 return scoped_ptr<WebSocketStream>( |
509 new WebSocketDeflateStream(basic_stream.Pass(), | 515 new WebSocketDeflateStream(basic_stream.Pass(), |
510 extension_params_->deflate_mode, | 516 extension_params_->deflate_mode, |
511 extension_params_->client_window_bits, | 517 extension_params_->client_window_bits, |
512 scoped_ptr<WebSocketDeflatePredictor>( | 518 scoped_ptr<WebSocketDeflatePredictor>( |
513 new WebSocketDeflatePredictorImpl))); | 519 new WebSocketDeflatePredictorImpl))); |
514 } else { | 520 } else { |
515 return basic_stream.Pass(); | 521 return basic_stream.Pass(); |
516 } | 522 } |
517 } | 523 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 &extensions_, | 616 &extensions_, |
611 &failure_message_, | 617 &failure_message_, |
612 extension_params_.get())) { | 618 extension_params_.get())) { |
613 return OK; | 619 return OK; |
614 } | 620 } |
615 failure_message_ = "Error during WebSocket handshake: " + failure_message_; | 621 failure_message_ = "Error during WebSocket handshake: " + failure_message_; |
616 return ERR_INVALID_RESPONSE; | 622 return ERR_INVALID_RESPONSE; |
617 } | 623 } |
618 | 624 |
619 } // namespace net | 625 } // namespace net |
OLD | NEW |