| 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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 } | 464 } |
| 465 | 465 |
| 466 bool WebSocketBasicHandshakeStream::IsConnectionReusable() const { | 466 bool WebSocketBasicHandshakeStream::IsConnectionReusable() const { |
| 467 return false; | 467 return false; |
| 468 } | 468 } |
| 469 | 469 |
| 470 int64 WebSocketBasicHandshakeStream::GetTotalReceivedBytes() const { | 470 int64 WebSocketBasicHandshakeStream::GetTotalReceivedBytes() const { |
| 471 return 0; | 471 return 0; |
| 472 } | 472 } |
| 473 | 473 |
| 474 int64 WebSocketBasicHandshakeStream::GetReceivedBodyLength() const { |
| 475 return 0; |
| 476 } |
| 477 |
| 474 bool WebSocketBasicHandshakeStream::GetLoadTimingInfo( | 478 bool WebSocketBasicHandshakeStream::GetLoadTimingInfo( |
| 475 LoadTimingInfo* load_timing_info) const { | 479 LoadTimingInfo* load_timing_info) const { |
| 476 return state_.connection()->GetLoadTimingInfo(IsConnectionReused(), | 480 return state_.connection()->GetLoadTimingInfo(IsConnectionReused(), |
| 477 load_timing_info); | 481 load_timing_info); |
| 478 } | 482 } |
| 479 | 483 |
| 480 void WebSocketBasicHandshakeStream::GetSSLInfo(SSLInfo* ssl_info) { | 484 void WebSocketBasicHandshakeStream::GetSSLInfo(SSLInfo* ssl_info) { |
| 481 parser()->GetSSLInfo(ssl_info); | 485 parser()->GetSSLInfo(ssl_info); |
| 482 } | 486 } |
| 483 | 487 |
| 484 void WebSocketBasicHandshakeStream::GetSSLCertRequestInfo( | 488 void WebSocketBasicHandshakeStream::GetSSLCertRequestInfo( |
| 485 SSLCertRequestInfo* cert_request_info) { | 489 SSLCertRequestInfo* cert_request_info) { |
| 486 parser()->GetSSLCertRequestInfo(cert_request_info); | 490 parser()->GetSSLCertRequestInfo(cert_request_info); |
| 487 } | 491 } |
| 488 | 492 |
| 489 bool WebSocketBasicHandshakeStream::IsSpdyHttpStream() const { return false; } | 493 bool WebSocketBasicHandshakeStream::IsSpdyHttpStream() const { return false; } |
| 490 | 494 |
| 491 void WebSocketBasicHandshakeStream::Drain(HttpNetworkSession* session) { | 495 void WebSocketBasicHandshakeStream::Drain(HttpNetworkSession* session) { |
| 492 HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this); | 496 HttpResponseBodyDrainer* drainer = new HttpResponseBodyDrainer(this); |
| 493 drainer->Start(session); | 497 drainer->Start(session); |
| 494 // |drainer| will delete itself. | 498 // |drainer| will delete itself. |
| 495 } | 499 } |
| 496 | 500 |
| 497 void WebSocketBasicHandshakeStream::SetPriority(RequestPriority priority) { | 501 void WebSocketBasicHandshakeStream::SetPriority(RequestPriority priority) { |
| 498 // TODO(ricea): See TODO comment in HttpBasicStream::SetPriority(). If it is | 502 // TODO(ricea): See TODO comment in HttpBasicStream::SetPriority(). If it is |
| 499 // gone, then copy whatever has happened there over here. | 503 // gone, then copy whatever has happened there over here. |
| 500 } | 504 } |
| 501 | 505 |
| 506 void WebSocketBasicHandshakeStream::SetRestartInfo(int64 read_offset, |
| 507 const void* hash, size_t hash_length) { |
| 508 // Nothing to do here. |
| 509 } |
| 510 |
| 511 void WebSocketBasicHandshakeStream::GetHash(void* output, size_t len) { |
| 512 // Nothing to do here. |
| 513 } |
| 514 |
| 502 scoped_ptr<WebSocketStream> WebSocketBasicHandshakeStream::Upgrade() { | 515 scoped_ptr<WebSocketStream> WebSocketBasicHandshakeStream::Upgrade() { |
| 503 // The HttpStreamParser object has a pointer to our ClientSocketHandle. Make | 516 // The HttpStreamParser object has a pointer to our ClientSocketHandle. Make |
| 504 // sure it does not touch it again before it is destroyed. | 517 // sure it does not touch it again before it is destroyed. |
| 505 state_.DeleteParser(); | 518 state_.DeleteParser(); |
| 506 WebSocketTransportClientSocketPool::UnlockEndpoint(state_.connection()); | 519 WebSocketTransportClientSocketPool::UnlockEndpoint(state_.connection()); |
| 507 scoped_ptr<WebSocketStream> basic_stream( | 520 scoped_ptr<WebSocketStream> basic_stream( |
| 508 new WebSocketBasicStream(state_.ReleaseConnection(), | 521 new WebSocketBasicStream(state_.ReleaseConnection(), |
| 509 state_.read_buf(), | 522 state_.read_buf(), |
| 510 sub_protocol_, | 523 sub_protocol_, |
| 511 extensions_)); | 524 extensions_)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 set_failure_message("Error during WebSocket handshake: " + failure_message); | 640 set_failure_message("Error during WebSocket handshake: " + failure_message); |
| 628 return ERR_INVALID_RESPONSE; | 641 return ERR_INVALID_RESPONSE; |
| 629 } | 642 } |
| 630 | 643 |
| 631 void WebSocketBasicHandshakeStream::set_failure_message( | 644 void WebSocketBasicHandshakeStream::set_failure_message( |
| 632 const std::string& failure_message) { | 645 const std::string& failure_message) { |
| 633 *failure_message_ = failure_message; | 646 *failure_message_ = failure_message; |
| 634 } | 647 } |
| 635 | 648 |
| 636 } // namespace net | 649 } // namespace net |
| OLD | NEW |