OLD | NEW |
1 // Copyright (c) 2011 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/http/http_proxy_client_socket.h" | 5 #include "net/http/http_proxy_client_socket.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
11 #include "net/base/host_port_pair.h" | 11 #include "net/base/host_port_pair.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 | 159 |
160 bool HttpProxyClientSocket::UsingTCPFastOpen() const { | 160 bool HttpProxyClientSocket::UsingTCPFastOpen() const { |
161 if (transport_.get() && transport_->socket()) { | 161 if (transport_.get() && transport_->socket()) { |
162 return transport_->socket()->UsingTCPFastOpen(); | 162 return transport_->socket()->UsingTCPFastOpen(); |
163 } | 163 } |
164 NOTREACHED(); | 164 NOTREACHED(); |
165 return false; | 165 return false; |
166 } | 166 } |
167 | 167 |
168 int64 HttpProxyClientSocket::NumBytesRead() const { | |
169 if (transport_.get() && transport_->socket()) { | |
170 return transport_->socket()->NumBytesRead(); | |
171 } | |
172 NOTREACHED(); | |
173 return -1; | |
174 } | |
175 | |
176 base::TimeDelta HttpProxyClientSocket::GetConnectTimeMicros() const { | |
177 if (transport_.get() && transport_->socket()) { | |
178 return transport_->socket()->GetConnectTimeMicros(); | |
179 } | |
180 NOTREACHED(); | |
181 return base::TimeDelta::FromMicroseconds(-1); | |
182 } | |
183 | |
184 int HttpProxyClientSocket::Read(IOBuffer* buf, int buf_len, | 168 int HttpProxyClientSocket::Read(IOBuffer* buf, int buf_len, |
185 CompletionCallback* callback) { | 169 CompletionCallback* callback) { |
186 DCHECK(!user_callback_); | 170 DCHECK(!user_callback_); |
187 if (next_state_ != STATE_DONE) { | 171 if (next_state_ != STATE_DONE) { |
188 // We're trying to read the body of the response but we're still trying | 172 // We're trying to read the body of the response but we're still trying |
189 // to establish an SSL tunnel through the proxy. We can't read these | 173 // to establish an SSL tunnel through the proxy. We can't read these |
190 // bytes when establishing a tunnel because they might be controlled by | 174 // bytes when establishing a tunnel because they might be controlled by |
191 // an active network attacker. We don't worry about this for HTTP | 175 // an active network attacker. We don't worry about this for HTTP |
192 // because an active network attacker can already control HTTP sessions. | 176 // because an active network attacker can already control HTTP sessions. |
193 // We reach this case when the user cancels a 407 proxy auth prompt. | 177 // We reach this case when the user cancels a 407 proxy auth prompt. |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 478 |
495 int HttpProxyClientSocket::DoTCPRestartComplete(int result) { | 479 int HttpProxyClientSocket::DoTCPRestartComplete(int result) { |
496 if (result != OK) | 480 if (result != OK) |
497 return result; | 481 return result; |
498 | 482 |
499 next_state_ = STATE_GENERATE_AUTH_TOKEN; | 483 next_state_ = STATE_GENERATE_AUTH_TOKEN; |
500 return result; | 484 return result; |
501 } | 485 } |
502 | 486 |
503 } // namespace net | 487 } // namespace net |
OLD | NEW |