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

Side by Side Diff: net/proxy/proxy_service.h

Issue 298883011: Record errors that trigger a data reduction proxy bypass (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments from mef Created 6 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
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 #ifndef NET_PROXY_PROXY_SERVICE_H_ 5 #ifndef NET_PROXY_PROXY_SERVICE_H_
6 #define NET_PROXY_PROXY_SERVICE_H_ 6 #define NET_PROXY_PROXY_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // Profiling information for the request is saved to |net_log| if non-NULL. 125 // Profiling information for the request is saved to |net_log| if non-NULL.
126 int ResolveProxy(const GURL& url, 126 int ResolveProxy(const GURL& url,
127 ProxyInfo* results, 127 ProxyInfo* results,
128 const net::CompletionCallback& callback, 128 const net::CompletionCallback& callback,
129 PacRequest** pac_request, 129 PacRequest** pac_request,
130 const BoundNetLog& net_log); 130 const BoundNetLog& net_log);
131 131
132 // This method is called after a failure to connect or resolve a host name. 132 // This method is called after a failure to connect or resolve a host name.
133 // It gives the proxy service an opportunity to reconsider the proxy to use. 133 // It gives the proxy service an opportunity to reconsider the proxy to use.
134 // The |results| parameter contains the results returned by an earlier call 134 // The |results| parameter contains the results returned by an earlier call
135 // to ResolveProxy. The semantics of this call are otherwise similar to 135 // to ResolveProxy. The |net_error| parameter contains the network error
136 // ResolveProxy. 136 // code associated with the failure. See "net/base/net_error_list.h" for a
137 // list of possible values. The semantics of this call are otherwise
138 // similar to ResolveProxy.
137 // 139 //
138 // NULL can be passed for |pac_request| if the caller will not need to 140 // NULL can be passed for |pac_request| if the caller will not need to
139 // cancel the request. 141 // cancel the request.
140 // 142 //
141 // Returns ERR_FAILED if there is not another proxy config to try. 143 // Returns ERR_FAILED if there is not another proxy config to try.
142 // 144 //
143 // Profiling information for the request is saved to |net_log| if non-NULL. 145 // Profiling information for the request is saved to |net_log| if non-NULL.
144 int ReconsiderProxyAfterError(const GURL& url, 146 int ReconsiderProxyAfterError(const GURL& url,
147 int net_error,
145 ProxyInfo* results, 148 ProxyInfo* results,
146 const CompletionCallback& callback, 149 const CompletionCallback& callback,
147 PacRequest** pac_request, 150 PacRequest** pac_request,
148 const BoundNetLog& net_log); 151 const BoundNetLog& net_log);
149 152
150 // Explicitly trigger proxy fallback for the given |results| by updating our 153 // Explicitly trigger proxy fallback for the given |results| by updating our
151 // list of bad proxies to include the first entry of |results|, and, 154 // list of bad proxies to include the first entry of |results|, and,
152 // optionally, another bad proxy. Will retry after |retry_delay| if positive, 155 // optionally, another bad proxy. Will retry after |retry_delay| if positive,
153 // and will use the default proxy retry duration otherwise. Proxies marked as 156 // and will use the default proxy retry duration otherwise. Proxies marked as
154 // bad will not be retried until |retry_delay| has passed. Returns true if 157 // bad will not be retried until |retry_delay| has passed. Returns true if
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 282
280 // Bypass the proxy because of an internal server error. 283 // Bypass the proxy because of an internal server error.
281 INTERNAL_SERVER_ERROR_BYPASS, 284 INTERNAL_SERVER_ERROR_BYPASS,
282 285
283 // Bypass the proxy because of any other error. 286 // Bypass the proxy because of any other error.
284 ERROR_BYPASS, 287 ERROR_BYPASS,
285 288
286 // Bypass the proxy because responses appear not to be coming via it. 289 // Bypass the proxy because responses appear not to be coming via it.
287 MISSING_VIA_HEADER, 290 MISSING_VIA_HEADER,
288 291
292 // Bypass the proxy because the proxy, not the origin, sent a 4xx response.
293 PROXY_4XX_BYPASS,
294
289 // This must always be last. 295 // This must always be last.
290 BYPASS_EVENT_TYPE_MAX 296 BYPASS_EVENT_TYPE_MAX
291 }; 297 };
292 298
293 // Records a |DataReductionProxyBypassEventType| for either the data reduction 299 // Records a |DataReductionProxyBypassEventType| for either the data reduction
294 // proxy (|is_primary| is true) or the data reduction proxy fallback. 300 // proxy (|is_primary| is true) or the data reduction proxy fallback.
295 void RecordDataReductionProxyBypassInfo( 301 void RecordDataReductionProxyBypassInfo(
296 bool is_primary, 302 bool is_primary,
297 const ProxyServer& proxy_server, 303 const ProxyServer& proxy_server,
298 DataReductionProxyBypassEventType bypass_type) const; 304 DataReductionProxyBypassEventType bypass_type) const;
305
306 // Records a net error code that resulted in bypassing the data reduction
307 // proxy (|is_primary| is true) or the data reduction proxy fallback.
308 void RecordDataReductionProxyBypassOnNetworkError(
309 bool is_primary,
310 const ProxyServer& proxy_server,
311 int net_error);
299 #endif 312 #endif
300 313
301 private: 314 private:
302 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); 315 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect);
303 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); 316 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect);
304 friend class PacRequest; 317 friend class PacRequest;
305 class InitProxyResolver; 318 class InitProxyResolver;
306 class ProxyScriptDeciderPoller; 319 class ProxyScriptDeciderPoller;
307 320
308 // TODO(eroman): change this to a std::set. Note that this requires updating 321 // TODO(eroman): change this to a std::set. Note that this requires updating
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 class NET_EXPORT SyncProxyServiceHelper 464 class NET_EXPORT SyncProxyServiceHelper
452 : public base::RefCountedThreadSafe<SyncProxyServiceHelper> { 465 : public base::RefCountedThreadSafe<SyncProxyServiceHelper> {
453 public: 466 public:
454 SyncProxyServiceHelper(base::MessageLoop* io_message_loop, 467 SyncProxyServiceHelper(base::MessageLoop* io_message_loop,
455 ProxyService* proxy_service); 468 ProxyService* proxy_service);
456 469
457 int ResolveProxy(const GURL& url, 470 int ResolveProxy(const GURL& url,
458 ProxyInfo* proxy_info, 471 ProxyInfo* proxy_info,
459 const BoundNetLog& net_log); 472 const BoundNetLog& net_log);
460 int ReconsiderProxyAfterError(const GURL& url, 473 int ReconsiderProxyAfterError(const GURL& url,
474 int net_error,
461 ProxyInfo* proxy_info, 475 ProxyInfo* proxy_info,
462 const BoundNetLog& net_log); 476 const BoundNetLog& net_log);
463 477
464 private: 478 private:
465 friend class base::RefCountedThreadSafe<SyncProxyServiceHelper>; 479 friend class base::RefCountedThreadSafe<SyncProxyServiceHelper>;
466 480
467 virtual ~SyncProxyServiceHelper(); 481 virtual ~SyncProxyServiceHelper();
468 482
469 void StartAsyncResolve(const GURL& url, const BoundNetLog& net_log); 483 void StartAsyncResolve(const GURL& url, const BoundNetLog& net_log);
470 void StartAsyncReconsider(const GURL& url, const BoundNetLog& net_log); 484 void StartAsyncReconsider(const GURL& url,
485 int net_error,
486 const BoundNetLog& net_log);
471 487
472 void OnCompletion(int result); 488 void OnCompletion(int result);
473 489
474 base::MessageLoop* io_message_loop_; 490 base::MessageLoop* io_message_loop_;
475 ProxyService* proxy_service_; 491 ProxyService* proxy_service_;
476 492
477 base::WaitableEvent event_; 493 base::WaitableEvent event_;
478 CompletionCallback callback_; 494 CompletionCallback callback_;
479 ProxyInfo proxy_info_; 495 ProxyInfo proxy_info_;
480 int result_; 496 int result_;
481 }; 497 };
482 498
483 } // namespace net 499 } // namespace net
484 500
485 #endif // NET_PROXY_PROXY_SERVICE_H_ 501 #endif // NET_PROXY_PROXY_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698