OLD | NEW |
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/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 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "net/http/proxy_connect_redirect_http_stream.h" | 26 #include "net/http/proxy_connect_redirect_http_stream.h" |
27 #include "net/log/net_log_event_type.h" | 27 #include "net/log/net_log_event_type.h" |
28 #include "net/log/net_log_source_type.h" | 28 #include "net/log/net_log_source_type.h" |
29 #include "net/spdy/spdy_http_utils.h" | 29 #include "net/spdy/spdy_http_utils.h" |
30 #include "url/gurl.h" | 30 #include "url/gurl.h" |
31 | 31 |
32 namespace net { | 32 namespace net { |
33 | 33 |
34 SpdyProxyClientSocket::SpdyProxyClientSocket( | 34 SpdyProxyClientSocket::SpdyProxyClientSocket( |
35 const base::WeakPtr<SpdyStream>& spdy_stream, | 35 const base::WeakPtr<SpdyStream>& spdy_stream, |
36 const std::string& user_agent, | 36 const SpdyString& user_agent, |
37 const HostPortPair& endpoint, | 37 const HostPortPair& endpoint, |
38 const HostPortPair& proxy_server, | 38 const HostPortPair& proxy_server, |
39 const NetLogWithSource& source_net_log, | 39 const NetLogWithSource& source_net_log, |
40 HttpAuthController* auth_controller) | 40 HttpAuthController* auth_controller) |
41 : next_state_(STATE_DISCONNECTED), | 41 : next_state_(STATE_DISCONNECTED), |
42 spdy_stream_(spdy_stream), | 42 spdy_stream_(spdy_stream), |
43 endpoint_(endpoint), | 43 endpoint_(endpoint), |
44 auth_(auth_controller), | 44 auth_(auth_controller), |
45 user_agent_(user_agent), | 45 user_agent_(user_agent), |
46 user_buffer_len_(0), | 46 user_buffer_len_(0), |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 344 |
345 int SpdyProxyClientSocket::DoSendRequest() { | 345 int SpdyProxyClientSocket::DoSendRequest() { |
346 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 346 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
347 | 347 |
348 // Add Proxy-Authentication header if necessary. | 348 // Add Proxy-Authentication header if necessary. |
349 HttpRequestHeaders authorization_headers; | 349 HttpRequestHeaders authorization_headers; |
350 if (auth_->HaveAuth()) { | 350 if (auth_->HaveAuth()) { |
351 auth_->AddAuthorizationHeader(&authorization_headers); | 351 auth_->AddAuthorizationHeader(&authorization_headers); |
352 } | 352 } |
353 | 353 |
354 std::string request_line; | 354 SpdyString request_line; |
355 BuildTunnelRequest(endpoint_, authorization_headers, user_agent_, | 355 BuildTunnelRequest(endpoint_, authorization_headers, user_agent_, |
356 &request_line, &request_.extra_headers); | 356 &request_line, &request_.extra_headers); |
357 | 357 |
358 net_log_.AddEvent( | 358 net_log_.AddEvent( |
359 NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 359 NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
360 base::Bind(&HttpRequestHeaders::NetLogCallback, | 360 base::Bind(&HttpRequestHeaders::NetLogCallback, |
361 base::Unretained(&request_.extra_headers), &request_line)); | 361 base::Unretained(&request_.extra_headers), &request_line)); |
362 | 362 |
363 SpdyHeaderBlock headers; | 363 SpdyHeaderBlock headers; |
364 CreateSpdyHeadersFromHttpRequest(request_, request_.extra_headers, true, | 364 CreateSpdyHeadersFromHttpRequest(request_, request_.extra_headers, true, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // This may have been deleted by read_callback_, so check first. | 525 // This may have been deleted by read_callback_, so check first. |
526 if (weak_ptr.get() && !write_callback.is_null()) | 526 if (weak_ptr.get() && !write_callback.is_null()) |
527 write_callback.Run(ERR_CONNECTION_CLOSED); | 527 write_callback.Run(ERR_CONNECTION_CLOSED); |
528 } | 528 } |
529 | 529 |
530 NetLogSource SpdyProxyClientSocket::source_dependency() const { | 530 NetLogSource SpdyProxyClientSocket::source_dependency() const { |
531 return source_dependency_; | 531 return source_dependency_; |
532 } | 532 } |
533 | 533 |
534 } // namespace net | 534 } // namespace net |
OLD | NEW |