OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/spdy/spdy_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
6 | 6 |
7 #include <algorithm> // min | 7 #include <algorithm> // min |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 // This will cause OnClose to be invoked, which takes care of | 98 // This will cause OnClose to be invoked, which takes care of |
99 // cleaning up all the internal state. | 99 // cleaning up all the internal state. |
100 spdy_stream_->Cancel(); | 100 spdy_stream_->Cancel(); |
101 } | 101 } |
102 | 102 |
103 bool SpdyProxyClientSocket::IsConnected() const { | 103 bool SpdyProxyClientSocket::IsConnected() const { |
104 return next_state_ == STATE_OPEN || next_state_ == STATE_CLOSED; | 104 return next_state_ == STATE_OPEN || next_state_ == STATE_CLOSED; |
105 } | 105 } |
106 | 106 |
107 bool SpdyProxyClientSocket::IsConnectedAndIdle() const { | 107 bool SpdyProxyClientSocket::IsConnectedAndIdle() const { |
108 return IsConnected() && !spdy_stream_->is_idle(); | 108 return IsConnected() && spdy_stream_.get() && !spdy_stream_->is_idle(); |
vandebo (ex-Chrome)
2010/12/04 00:30:37
Why did this change?
Ryan Hamilton
2010/12/09 21:19:35
Bug, actually. Removed.
| |
109 } | 109 } |
110 | 110 |
111 void SpdyProxyClientSocket::SetSubresourceSpeculation() { | 111 void SpdyProxyClientSocket::SetSubresourceSpeculation() { |
112 // TODO(rch): what should this implementation be? | 112 // TODO(rch): what should this implementation be? |
113 } | 113 } |
114 | 114 |
115 void SpdyProxyClientSocket::SetOmniboxSpeculation() { | 115 void SpdyProxyClientSocket::SetOmniboxSpeculation() { |
116 // TODO(rch): what should this implementation be? | 116 // TODO(rch): what should this implementation be? |
117 } | 117 } |
118 | 118 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 | 348 |
349 next_state_ = STATE_OPEN; | 349 next_state_ = STATE_OPEN; |
350 if (net_log_.IsLoggingAllEvents()) { | 350 if (net_log_.IsLoggingAllEvents()) { |
351 net_log_.AddEvent( | 351 net_log_.AddEvent( |
352 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 352 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
353 make_scoped_refptr(new NetLogHttpResponseParameter(response_.headers))); | 353 make_scoped_refptr(new NetLogHttpResponseParameter(response_.headers))); |
354 } | 354 } |
355 | 355 |
356 if (response_.headers->response_code() == 200) | 356 if (response_.headers->response_code() == 200) |
357 return OK; | 357 return OK; |
358 else if (response_.headers->response_code() == 407) | |
359 return ERR_TUNNEL_CONNECTION_FAILED; | |
358 else | 360 else |
359 return ERR_TUNNEL_CONNECTION_FAILED; | 361 return ERR_HTTPS_PROXY_TUNNEL_CONNECTION_RESPONSE; |
360 } | 362 } |
361 | 363 |
362 // SpdyStream::Delegate methods: | 364 // SpdyStream::Delegate methods: |
363 // Called when SYN frame has been sent. | 365 // Called when SYN frame has been sent. |
364 // Returns true if no more data to be sent after SYN frame. | 366 // Returns true if no more data to be sent after SYN frame. |
365 bool SpdyProxyClientSocket::OnSendHeadersComplete(int status) { | 367 bool SpdyProxyClientSocket::OnSendHeadersComplete(int status) { |
366 DCHECK_EQ(next_state_, STATE_SEND_REQUEST_COMPLETE); | 368 DCHECK_EQ(next_state_, STATE_SEND_REQUEST_COMPLETE); |
367 | 369 |
368 OnIOComplete(status); | 370 OnIOComplete(status); |
369 | 371 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 read_callback->Run(status); | 464 read_callback->Run(status); |
463 } else if (read_callback_) { | 465 } else if (read_callback_) { |
464 // If we have a read_callback, the we need to make sure we call it back | 466 // If we have a read_callback, the we need to make sure we call it back |
465 OnDataReceived(NULL, 0); | 467 OnDataReceived(NULL, 0); |
466 } | 468 } |
467 if (write_callback) | 469 if (write_callback) |
468 write_callback->Run(ERR_CONNECTION_CLOSED); | 470 write_callback->Run(ERR_CONNECTION_CLOSED); |
469 } | 471 } |
470 | 472 |
471 } // namespace net | 473 } // namespace net |
OLD | NEW |