Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: net/http/http_proxy_client_socket.cc

Issue 6990036: Deciding best connection to schedule requests on based on cwnd and idle time (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 tunnel_(tunnel), 49 tunnel_(tunnel),
50 using_spdy_(using_spdy), 50 using_spdy_(using_spdy),
51 is_https_proxy_(is_https_proxy), 51 is_https_proxy_(is_https_proxy),
52 net_log_(transport_socket->socket()->NetLog()) { 52 net_log_(transport_socket->socket()->NetLog()) {
53 // Synthesize the bits of a request that we actually use. 53 // Synthesize the bits of a request that we actually use.
54 request_.url = request_url; 54 request_.url = request_url;
55 request_.method = "GET"; 55 request_.method = "GET";
56 if (!user_agent.empty()) 56 if (!user_agent.empty())
57 request_.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent, 57 request_.extra_headers.SetHeader(HttpRequestHeaders::kUserAgent,
58 user_agent); 58 user_agent);
59 rtt_ms_ = transport_->socket()->GetRTTMs();
59 } 60 }
60 61
61 HttpProxyClientSocket::~HttpProxyClientSocket() { 62 HttpProxyClientSocket::~HttpProxyClientSocket() {
62 Disconnect(); 63 Disconnect();
63 } 64 }
64 65
65 int HttpProxyClientSocket::RestartWithAuth(CompletionCallback* callback) { 66 int HttpProxyClientSocket::RestartWithAuth(CompletionCallback* callback) {
66 DCHECK_EQ(STATE_NONE, next_state_); 67 DCHECK_EQ(STATE_NONE, next_state_);
67 DCHECK(!user_callback_); 68 DCHECK(!user_callback_);
68 69
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // an active network attacker. We don't worry about this for HTTP 176 // an active network attacker. We don't worry about this for HTTP
176 // because an active network attacker can already control HTTP sessions. 177 // because an active network attacker can already control HTTP sessions.
177 // We reach this case when the user cancels a 407 proxy auth prompt. 178 // We reach this case when the user cancels a 407 proxy auth prompt.
178 // See http://crbug.com/8473. 179 // See http://crbug.com/8473.
179 DCHECK_EQ(407, response_.headers->response_code()); 180 DCHECK_EQ(407, response_.headers->response_code());
180 LogBlockedTunnelResponse(response_.headers->response_code()); 181 LogBlockedTunnelResponse(response_.headers->response_code());
181 182
182 return ERR_TUNNEL_CONNECTION_FAILED; 183 return ERR_TUNNEL_CONNECTION_FAILED;
183 } 184 }
184 185
185 return transport_->socket()->Read(buf, buf_len, callback); 186 int num = transport_->socket()->Read(buf, buf_len, callback);
187 num_bytes_read_ += num;
188 return num;
186 } 189 }
187 190
188 int HttpProxyClientSocket::Write(IOBuffer* buf, int buf_len, 191 int HttpProxyClientSocket::Write(IOBuffer* buf, int buf_len,
189 CompletionCallback* callback) { 192 CompletionCallback* callback) {
190 DCHECK_EQ(STATE_DONE, next_state_); 193 DCHECK_EQ(STATE_DONE, next_state_);
191 DCHECK(!user_callback_); 194 DCHECK(!user_callback_);
192 195
193 return transport_->socket()->Write(buf, buf_len, callback); 196 return transport_->socket()->Write(buf, buf_len, callback);
194 } 197 }
195 198
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 481
479 int HttpProxyClientSocket::DoTCPRestartComplete(int result) { 482 int HttpProxyClientSocket::DoTCPRestartComplete(int result) {
480 if (result != OK) 483 if (result != OK)
481 return result; 484 return result;
482 485
483 next_state_ = STATE_GENERATE_AUTH_TOKEN; 486 next_state_ = STATE_GENERATE_AUTH_TOKEN;
484 return result; 487 return result;
485 } 488 }
486 489
487 } // namespace net 490 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698