diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 22:30:21 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-25 22:30:21 +0000 |
commit | 2fd33ee9acea0037b010901af1601616c21cc37d (patch) | |
tree | 9109f46ae1e4efe4ec8d345853064113e6379915 /net/tools | |
parent | 49a9415f1fd04e05c2d75e884a0aced8e0d76063 (diff) | |
download | chromium_src-2fd33ee9acea0037b010901af1601616c21cc37d.zip chromium_src-2fd33ee9acea0037b010901af1601616c21cc37d.tar.gz chromium_src-2fd33ee9acea0037b010901af1601616c21cc37d.tar.bz2 |
Add an opt-out header for HTTP throttling. Never throttle for localhost.
Added net::IsLocalhost() function to net/base/net_utils.h
Unit tests for the above. Also fix flakiness in the ReceivedContentMalformed test that was caused by non-zero jitter.
Modify back-off policy to ignore first 4 errors to help avoid back-off from erroneously kicking in on flaky connections. Make maximum back-off period 15 minutes instead of 60. Added documentation of results of analyzing behavior this new policy will give.
Add a simple server for manual testing of the throttling feature.
BUG=66062
TEST=net_unittests
Review URL: http://codereview.chromium.org/6711046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79464 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rw-r--r-- | net/tools/testserver/backoff_server.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/net/tools/testserver/backoff_server.py b/net/tools/testserver/backoff_server.py new file mode 100644 index 0000000..4188cd1 --- /dev/null +++ b/net/tools/testserver/backoff_server.py @@ -0,0 +1,51 @@ +#!/usr/bin/python2.4
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""This is a simple HTTP server for manually testing exponential
+back-off functionality in Chrome.
+"""
+
+
+import BaseHTTPServer
+import sys
+import urlparse
+
+
+class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+ keep_running = True
+
+ def do_GET(self):
+ if self.path == '/quitquitquit':
+ self.send_response(200)
+ self.send_header('Content-Type', 'text/plain')
+ self.end_headers()
+ self.wfile.write('QUITTING')
+ RequestHandler.keep_running = False
+ return
+
+ params = urlparse.parse_qs(urlparse.urlparse(self.path).query)
+
+ if not params or not 'code' in params or params['code'][0] == '200':
+ self.send_response(200)
+ self.send_header('Content-Type', 'text/plain')
+ self.end_headers()
+ self.wfile.write('OK')
+ else:
+ self.send_error(int(params['code'][0]))
+
+
+def main():
+ if len(sys.argv) != 2:
+ print "Usage: %s PORT" % sys.argv[0]
+ sys.exit(1)
+ port = int(sys.argv[1])
+ print "To stop the server, go to http://localhost:%d/quitquitquit" % port
+ httpd = BaseHTTPServer.HTTPServer(('', port), RequestHandler)
+ while RequestHandler.keep_running:
+ httpd.handle_request()
+
+
+if __name__ == '__main__':
+ main()
|