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

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

Issue 1063563002: Simplify the interface to ProxyClientSocket::BuildTunnelRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix WebSocketStreamCreateTest.HandleErrTunnelConnectionFailed Created 5 years, 8 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
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/proxy_client_socket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 http_stream_parser_.reset(); 295 http_stream_parser_.reset();
296 request_line_.clear(); 296 request_line_.clear();
297 request_headers_.Clear(); 297 request_headers_.Clear();
298 response_ = HttpResponseInfo(); 298 response_ = HttpResponseInfo();
299 return OK; 299 return OK;
300 } 300 }
301 301
302 void HttpProxyClientSocket::LogBlockedTunnelResponse() const { 302 void HttpProxyClientSocket::LogBlockedTunnelResponse() const {
303 ProxyClientSocket::LogBlockedTunnelResponse( 303 ProxyClientSocket::LogBlockedTunnelResponse(
304 response_.headers->response_code(), 304 response_.headers->response_code(),
305 request_.url,
306 is_https_proxy_); 305 is_https_proxy_);
307 } 306 }
308 307
309 void HttpProxyClientSocket::DoCallback(int result) { 308 void HttpProxyClientSocket::DoCallback(int result) {
310 DCHECK_NE(ERR_IO_PENDING, result); 309 DCHECK_NE(ERR_IO_PENDING, result);
311 DCHECK(!user_callback_.is_null()); 310 DCHECK(!user_callback_.is_null());
312 311
313 // Since Run() may result in Read being called, 312 // Since Run() may result in Read being called,
314 // clear user_callback_ up front. 313 // clear user_callback_ up front.
315 CompletionCallback c = user_callback_; 314 CompletionCallback c = user_callback_;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 // we have proxy info available. 406 // we have proxy info available.
408 if (request_line_.empty()) { 407 if (request_line_.empty()) {
409 DCHECK(request_headers_.IsEmpty()); 408 DCHECK(request_headers_.IsEmpty());
410 HttpRequestHeaders authorization_headers; 409 HttpRequestHeaders authorization_headers;
411 if (auth_->HaveAuth()) 410 if (auth_->HaveAuth())
412 auth_->AddAuthorizationHeader(&authorization_headers); 411 auth_->AddAuthorizationHeader(&authorization_headers);
413 if (proxy_delegate_) { 412 if (proxy_delegate_) {
414 proxy_delegate_->OnBeforeTunnelRequest(proxy_server_, 413 proxy_delegate_->OnBeforeTunnelRequest(proxy_server_,
415 &authorization_headers); 414 &authorization_headers);
416 } 415 }
417 BuildTunnelRequest(request_, authorization_headers, endpoint_, 416 std::string user_agent;
417 if (!request_.extra_headers.GetHeader(HttpRequestHeaders::kUserAgent,
418 &user_agent)) {
419 user_agent.clear();
420 }
421 BuildTunnelRequest(endpoint_, authorization_headers, user_agent,
418 &request_line_, &request_headers_); 422 &request_line_, &request_headers_);
419 423
420 net_log_.AddEvent( 424 net_log_.AddEvent(
421 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, 425 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS,
422 base::Bind(&HttpRequestHeaders::NetLogCallback, 426 base::Bind(&HttpRequestHeaders::NetLogCallback,
423 base::Unretained(&request_headers_), 427 base::Unretained(&request_headers_),
424 &request_line_)); 428 &request_line_));
425 } 429 }
426 430
427 parser_buf_ = new GrowableIOBuffer(); 431 parser_buf_ = new GrowableIOBuffer();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 "462784 HttpProxyClientSocket::DoTCPRestartComplete")); 556 "462784 HttpProxyClientSocket::DoTCPRestartComplete"));
553 557
554 if (result != OK) 558 if (result != OK)
555 return result; 559 return result;
556 560
557 next_state_ = STATE_GENERATE_AUTH_TOKEN; 561 next_state_ = STATE_GENERATE_AUTH_TOKEN;
558 return result; 562 return result;
559 } 563 }
560 564
561 } // namespace net 565 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/proxy_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698