| 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_job.h" | 5 #include "net/websockets/websocket_job.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 socket_->proxy_server()); | 554 socket_->proxy_server()); |
| 555 if (!spdy_pool->HasSession(pair)) | 555 if (!spdy_pool->HasSession(pair)) |
| 556 return OK; | 556 return OK; |
| 557 | 557 |
| 558 // Forbid wss downgrade to SPDY without SSL. | 558 // Forbid wss downgrade to SPDY without SSL. |
| 559 // TODO(toyoshim): Does it realize the same policy with HTTP? | 559 // TODO(toyoshim): Does it realize the same policy with HTTP? |
| 560 scoped_refptr<SpdySession> spdy_session = | 560 scoped_refptr<SpdySession> spdy_session = |
| 561 spdy_pool->Get(pair, *socket_->net_log()); | 561 spdy_pool->Get(pair, *socket_->net_log()); |
| 562 SSLInfo ssl_info; | 562 SSLInfo ssl_info; |
| 563 bool was_npn_negotiated; | 563 bool was_npn_negotiated; |
| 564 SSLClientSocket::NextProto protocol_negotiated = | 564 NextProto protocol_negotiated = kProtoUnknown; |
| 565 SSLClientSocket::kProtoUnknown; | |
| 566 bool use_ssl = spdy_session->GetSSLInfo( | 565 bool use_ssl = spdy_session->GetSSLInfo( |
| 567 &ssl_info, &was_npn_negotiated, &protocol_negotiated); | 566 &ssl_info, &was_npn_negotiated, &protocol_negotiated); |
| 568 if (socket_->is_secure() && !use_ssl) | 567 if (socket_->is_secure() && !use_ssl) |
| 569 return OK; | 568 return OK; |
| 570 | 569 |
| 571 // Create SpdyWebSocketStream. | 570 // Create SpdyWebSocketStream. |
| 572 spdy_websocket_stream_.reset(new SpdyWebSocketStream(spdy_session, this)); | 571 spdy_websocket_stream_.reset(new SpdyWebSocketStream(spdy_session, this)); |
| 573 | 572 |
| 574 int result = spdy_websocket_stream_->InitializeStream( | 573 int result = spdy_websocket_stream_->InitializeStream( |
| 575 socket_->url(), MEDIUM, *socket_->net_log()); | 574 socket_->url(), MEDIUM, *socket_->net_log()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 | 651 |
| 653 scoped_refptr<IOBufferWithSize> next_buffer = send_buffer_queue_.front(); | 652 scoped_refptr<IOBufferWithSize> next_buffer = send_buffer_queue_.front(); |
| 654 send_buffer_queue_.pop_front(); | 653 send_buffer_queue_.pop_front(); |
| 655 current_send_buffer_ = new DrainableIOBuffer(next_buffer, | 654 current_send_buffer_ = new DrainableIOBuffer(next_buffer, |
| 656 next_buffer->size()); | 655 next_buffer->size()); |
| 657 SendDataInternal(current_send_buffer_->data(), | 656 SendDataInternal(current_send_buffer_->data(), |
| 658 current_send_buffer_->BytesRemaining()); | 657 current_send_buffer_->BytesRemaining()); |
| 659 } | 658 } |
| 660 | 659 |
| 661 } // namespace net | 660 } // namespace net |
| OLD | NEW |