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

Unified Diff: net/tools/backoff_server/backoff_server.py

Issue 6711046: Add an opt-out header for HTTP throttling. Never throttle for localhost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update copyright years. Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/tools/backoff_server/backoff_server.py
diff --git a/net/tools/backoff_server/backoff_server.py b/net/tools/backoff_server/backoff_server.py
new file mode 100644
index 0000000000000000000000000000000000000000..9db0c0cc247d0ecd6f9ac87d5cf42f9db04b6bab
--- /dev/null
+++ b/net/tools/backoff_server/backoff_server.py
@@ -0,0 +1,46 @@
+#!/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():
+ httpd = BaseHTTPServer.HTTPServer(('', int(sys.argv[1])), RequestHandler)
yzshen1 2011/03/18 22:49:51 It is good if some more comments are added for thi
Jói 2011/03/23 23:38:24 Done.
+ while RequestHandler.keep_running:
+ httpd.handle_request()
+
+
+if __name__ == '__main__':
+ main()

Powered by Google App Engine
This is Rietveld 408576698