summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 20:04:11 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-13 20:04:11 +0000
commitc5ad3e107f28390f9a822df6a7008e3c52d3c017 (patch)
tree19b1f4578e2bd11f33ce6bdded1b3a4634d18e39 /net/url_request
parentd3ce6c2c6d203f9479530ac46fc5af9e8a9ccffe (diff)
downloadchromium_src-c5ad3e107f28390f9a822df6a7008e3c52d3c017.zip
chromium_src-c5ad3e107f28390f9a822df6a7008e3c52d3c017.tar.gz
chromium_src-c5ad3e107f28390f9a822df6a7008e3c52d3c017.tar.bz2
Add more functionality to about:net-internals:
(1) Display the cached bad proxies, and how long until they will be retried (addresses an old TODO). (2) Add a button to clear the bad proxies cache. (3) Add a button to force refetching of the proxy configuration (this can be used to force refetch of PAC files, very convenient when testing). BUG=none TEST=none Review URL: http://codereview.chromium.org/541045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36159 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/url_request_view_net_internals_job.cc48
1 files changed, 46 insertions, 2 deletions
diff --git a/net/url_request/url_request_view_net_internals_job.cc b/net/url_request/url_request_view_net_internals_job.cc
index 58aa3d7..365c92c 100644
--- a/net/url_request/url_request_view_net_internals_job.cc
+++ b/net/url_request/url_request_view_net_internals_job.cc
@@ -161,7 +161,8 @@ class ProxyServiceCurrentConfigSubSection : public SubSection {
}
virtual void OutputBody(URLRequestContext* context, std::string* out) {
- // TODO(eroman): add a button to force reloading the proxy config.
+ DrawCommandButton("Force reload", "reload-proxy-config", out);
+
net::ProxyService* proxy_service = context->proxy_service();
if (proxy_service->config_has_been_initialized()) {
// net::ProxyConfig defines an operator<<.
@@ -198,7 +199,39 @@ class ProxyServiceBadProxiesSubSection : public SubSection {
}
virtual void OutputBody(URLRequestContext* context, std::string* out) {
- out->append("TODO");
+ net::ProxyService* proxy_service = context->proxy_service();
+ const net::ProxyRetryInfoMap& bad_proxies_map =
+ proxy_service->proxy_retry_info();
+
+ DrawCommandButton("Clear", "clear-badproxies", out);
+
+ out->append("<table border=1>");
+ out->append("<tr><th>Bad proxy server</th>"
+ "<th>Remaining time until retry (ms)</th></tr>");
+
+ for (net::ProxyRetryInfoMap::const_iterator it = bad_proxies_map.begin();
+ it != bad_proxies_map.end(); ++it) {
+ const std::string& proxy_uri = it->first;
+ const net::ProxyRetryInfo& retry_info = it->second;
+
+ // Note that ttl_ms may be negative, for the cases where entries have
+ // expired but not been garbage collected yet.
+ int ttl_ms = static_cast<int>(
+ (retry_info.bad_until - base::TimeTicks::Now()).InMilliseconds());
+
+ // Color expired entries blue.
+ if (ttl_ms > 0)
+ out->append("<tr>");
+ else
+ out->append("<tr style='color:blue'>");
+
+ StringAppendF(out, "<td>%s</td><td>%d</td>",
+ EscapeForHTML(proxy_uri).c_str(),
+ ttl_ms);
+
+ out->append("</tr>");
+ }
+ out->append("</table>");
}
};
@@ -504,6 +537,16 @@ bool HandleCommand(const std::string& command, URLRequestContext* context) {
return true;
}
+ if (command == "clear-badproxies") {
+ context->proxy_service()->ClearBadProxiesCache();
+ return true;
+ }
+
+ if (command == "reload-proxy-config") {
+ context->proxy_service()->ForceReloadProxyConfig();
+ return true;
+ }
+
return false;
}
@@ -544,6 +587,7 @@ void DrawControlsHeader(URLRequestContext* context, std::string* data) {
DrawCommandButton("Clear all data",
// Send a list of comma separated commands:
+ "clear-badproxies,"
"clear-hostcache,"
"clear-urlrequest-graveyard,"
"clear-socketstream-graveyard",