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

Side by Side Diff: net/spdy/spdy_proxy_client_socket.cc

Issue 2783683002: Log source_dependency in HTTP2_SESSION_SEND_HEADERS. (Closed)
Patch Set: Fix use-after-free. Created 3 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/spdy/spdy_proxy_client_socket.h ('k') | net/spdy/spdy_session.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/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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/callback_helpers.h" 13 #include "base/callback_helpers.h"
14 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "net/base/auth.h" 20 #include "net/base/auth.h"
21 #include "net/base/io_buffer.h" 21 #include "net/base/io_buffer.h"
22 #include "net/http/http_auth_cache.h" 22 #include "net/http/http_auth_cache.h"
23 #include "net/http/http_auth_handler_factory.h" 23 #include "net/http/http_auth_handler_factory.h"
24 #include "net/http/http_request_info.h" 24 #include "net/http/http_request_info.h"
25 #include "net/http/http_response_headers.h" 25 #include "net/http/http_response_headers.h"
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.h"
29 #include "net/log/net_log_source_type.h" 28 #include "net/log/net_log_source_type.h"
30 #include "net/spdy/spdy_http_utils.h" 29 #include "net/spdy/spdy_http_utils.h"
31 #include "url/gurl.h" 30 #include "url/gurl.h"
32 31
33 namespace net { 32 namespace net {
34 33
35 SpdyProxyClientSocket::SpdyProxyClientSocket( 34 SpdyProxyClientSocket::SpdyProxyClientSocket(
36 const base::WeakPtr<SpdyStream>& spdy_stream, 35 const base::WeakPtr<SpdyStream>& spdy_stream,
37 const std::string& user_agent, 36 const std::string& user_agent,
38 const HostPortPair& endpoint, 37 const HostPortPair& endpoint,
39 const HostPortPair& proxy_server, 38 const HostPortPair& proxy_server,
40 const NetLogWithSource& source_net_log, 39 const NetLogWithSource& source_net_log,
41 HttpAuthController* auth_controller) 40 HttpAuthController* auth_controller)
42 : next_state_(STATE_DISCONNECTED), 41 : next_state_(STATE_DISCONNECTED),
43 spdy_stream_(spdy_stream), 42 spdy_stream_(spdy_stream),
44 endpoint_(endpoint), 43 endpoint_(endpoint),
45 auth_(auth_controller), 44 auth_(auth_controller),
46 user_agent_(user_agent), 45 user_agent_(user_agent),
47 user_buffer_len_(0), 46 user_buffer_len_(0),
48 write_buffer_len_(0), 47 write_buffer_len_(0),
49 was_ever_used_(false), 48 was_ever_used_(false),
50 redirect_has_load_timing_info_(false), 49 redirect_has_load_timing_info_(false),
51 net_log_(NetLogWithSource::Make(spdy_stream->net_log().net_log(), 50 net_log_(NetLogWithSource::Make(spdy_stream->net_log().net_log(),
52 NetLogSourceType::PROXY_CLIENT_SOCKET)), 51 NetLogSourceType::PROXY_CLIENT_SOCKET)),
52 source_dependency_(source_net_log.source()),
53 weak_factory_(this), 53 weak_factory_(this),
54 write_callback_weak_factory_(this) { 54 write_callback_weak_factory_(this) {
55 request_.method = "CONNECT"; 55 request_.method = "CONNECT";
56 request_.url = GURL("https://" + endpoint.ToString()); 56 request_.url = GURL("https://" + endpoint.ToString());
57 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE, 57 net_log_.BeginEvent(NetLogEventType::SOCKET_ALIVE,
58 source_net_log.source().ToEventParametersCallback()); 58 source_net_log.source().ToEventParametersCallback());
59 net_log_.AddEvent( 59 net_log_.AddEvent(
60 NetLogEventType::HTTP2_PROXY_CLIENT_SESSION, 60 NetLogEventType::HTTP2_PROXY_CLIENT_SESSION,
61 spdy_stream->net_log().source().ToEventParametersCallback()); 61 spdy_stream->net_log().source().ToEventParametersCallback());
62 62
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 read_callback.Run(status); 520 read_callback.Run(status);
521 } else if (!read_callback_.is_null()) { 521 } else if (!read_callback_.is_null()) {
522 // If we have a read_callback_, the we need to make sure we call it back. 522 // If we have a read_callback_, the we need to make sure we call it back.
523 OnDataReceived(std::unique_ptr<SpdyBuffer>()); 523 OnDataReceived(std::unique_ptr<SpdyBuffer>());
524 } 524 }
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 {
531 return source_dependency_;
532 }
533
530 } // namespace net 534 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.h ('k') | net/spdy/spdy_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698