| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 request_.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, | 52 request_.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, |
| 53 user_agent); | 53 user_agent); |
| 54 spdy_stream_->SetDelegate(this); | 54 spdy_stream_->SetDelegate(this); |
| 55 was_ever_used_ = spdy_stream_->WasEverUsed(); | 55 was_ever_used_ = spdy_stream_->WasEverUsed(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 SpdyProxyClientSocket::~SpdyProxyClientSocket() { | 58 SpdyProxyClientSocket::~SpdyProxyClientSocket() { |
| 59 Disconnect(); | 59 Disconnect(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 const HttpResponseInfo* SpdyProxyClientSocket::GetConnectResponseInfo() const { |
| 63 return response_.headers ? &response_ : NULL; |
| 64 } |
| 65 |
| 62 HttpStream* SpdyProxyClientSocket::CreateConnectResponseStream() { | 66 HttpStream* SpdyProxyClientSocket::CreateConnectResponseStream() { |
| 63 DCHECK(response_stream_.get()); | 67 DCHECK(response_stream_.get()); |
| 64 return response_stream_.release(); | 68 return response_stream_.release(); |
| 65 } | 69 } |
| 66 | 70 |
| 67 // Sends a SYN_STREAM frame to the proxy with a CONNECT request | 71 // Sends a SYN_STREAM frame to the proxy with a CONNECT request |
| 68 // for the specified endpoint. Waits for the server to send back | 72 // for the specified endpoint. Waits for the server to send back |
| 69 // a SYN_REPLY frame. OK will be returned if the status is 200. | 73 // a SYN_REPLY frame. OK will be returned if the status is 200. |
| 70 // ERR_TUNNEL_CONNECTION_FAILED will be returned for any other status. | 74 // ERR_TUNNEL_CONNECTION_FAILED will be returned for any other status. |
| 71 // In any of these cases, Read() may be called to retrieve the HTTP | 75 // In any of these cases, Read() may be called to retrieve the HTTP |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 read_callback->Run(status); | 492 read_callback->Run(status); |
| 489 } else if (read_callback_) { | 493 } else if (read_callback_) { |
| 490 // If we have a read_callback, the we need to make sure we call it back | 494 // If we have a read_callback, the we need to make sure we call it back |
| 491 OnDataReceived(NULL, 0); | 495 OnDataReceived(NULL, 0); |
| 492 } | 496 } |
| 493 if (write_callback) | 497 if (write_callback) |
| 494 write_callback->Run(ERR_CONNECTION_CLOSED); | 498 write_callback->Run(ERR_CONNECTION_CLOSED); |
| 495 } | 499 } |
| 496 | 500 |
| 497 } // namespace net | 501 } // namespace net |
| OLD | NEW |