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

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

Issue 42013: Slight code change to make some global variables const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 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
« no previous file with comments | « net/proxy/proxy_service_unittest.cc ('k') | net/url_request/url_request_ftp_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/testserver/testserver.py
===================================================================
--- net/tools/testserver/testserver.py (revision 11293)
+++ net/tools/testserver/testserver.py (working copy)
@@ -120,10 +120,16 @@
self.EchoAllHandler,
self.EchoHandler] + self._get_handlers
- self._mime_types = { 'gif': 'image/gif', 'jpeg' : 'image/jpeg', 'jpg' : 'image/jpeg' }
+ self._mime_types = {
+ 'gif': 'image/gif',
+ 'jpeg' : 'image/jpeg',
+ 'jpg' : 'image/jpeg'
+ }
self._default_mime_type = 'text/html'
- BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, request, client_address, socket_server)
+ BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, request,
+ client_address,
+ socket_server)
def _ShouldHandleRequest(self, handler_name):
"""Determines if the path can be handled by the handler.
@@ -174,7 +180,8 @@
self.send_header('Content-type', 'text/html')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -190,7 +197,8 @@
self.send_header('Content-type', 'text/html')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -206,7 +214,8 @@
self.send_header('Content-type', 'text/html')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -222,7 +231,8 @@
self.send_header('Content-type', 'text/html')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -238,7 +248,8 @@
self.send_header('Cache-Control', 'max-age=60, proxy-revalidate')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -254,7 +265,8 @@
self.send_header('Cache-Control', 'max-age=5, private')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -270,7 +282,8 @@
self.send_header('Cache-Control', 'max-age=5, public')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -286,7 +299,8 @@
self.send_header('Cache-Control', 'public, s-maxage = 60, max-age = 0')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -302,7 +316,8 @@
self.send_header('Cache-Control', 'must-revalidate')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -319,7 +334,8 @@
self.send_header('Cache-Control', 'max-age=60, must-revalidate')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -335,7 +351,8 @@
self.send_header('Cache-Control', 'no-store')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -352,7 +369,8 @@
self.send_header('Cache-Control', 'max-age=60, no-store')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -370,7 +388,8 @@
self.send_header('Cache-Control', 'no-transform')
self.end_headers()
- self.wfile.write('<html><head><title>%s</title></head></html>' % time.time())
+ self.wfile.write('<html><head><title>%s</title></head></html>' %
+ time.time())
return True
@@ -730,12 +749,14 @@
# the request URL into this, but we don't care for testing.
nonce_life = 10
stale = False
- if not self.server.nonce or (time.time() - self.server.nonce_time > nonce_life):
+ if (not self.server.nonce or
+ (time.time() - self.server.nonce_time > nonce_life)):
if self.server.nonce:
stale = True
self.server.nonce_time = time.time()
self.server.nonce = \
- _new_md5(time.ctime(self.server.nonce_time) + 'privatekey').hexdigest()
+ _new_md5(time.ctime(self.server.nonce_time) +
+ 'privatekey').hexdigest()
nonce = self.server.nonce
opaque = _new_md5('opaque').hexdigest()
@@ -760,7 +781,8 @@
# Check the 'response' value and make sure it matches our magic hash.
# See http://www.ietf.org/rfc/rfc2617.txt
- hash_a1 = _new_md5(':'.join([pairs['username'], realm, password])).hexdigest()
+ hash_a1 = _new_md5(
+ ':'.join([pairs['username'], realm, password])).hexdigest()
hash_a2 = _new_md5(':'.join([self.command, pairs['uri']])).hexdigest()
if 'qop' in pairs and 'nc' in pairs and 'cnonce' in pairs:
response = _new_md5(':'.join([hash_a1, nonce, pairs['nc'],
@@ -845,7 +867,8 @@
def ServerRedirectHandler(self):
"""Sends a server redirect to the given URL. The syntax is
- '/server-redirect?http://foo.bar/asdf' to redirect to 'http://foo.bar/asdf'"""
+ '/server-redirect?http://foo.bar/asdf' to redirect to
+ 'http://foo.bar/asdf'"""
test_name = "/server-redirect"
if not self._ShouldHandleRequest(test_name):
@@ -868,7 +891,8 @@
def ClientRedirectHandler(self):
"""Sends a client redirect to the given URL. The syntax is
- '/client-redirect?http://foo.bar/asdf' to redirect to 'http://foo.bar/asdf'"""
+ '/client-redirect?http://foo.bar/asdf' to redirect to
+ 'http://foo.bar/asdf'"""
test_name = "/client-redirect"
if not self._ShouldHandleRequest(test_name):
@@ -1045,7 +1069,8 @@
pyftpdlib.ftpserver.logline = line_logger
# Define a customized banner (string returned when client connects)
- ftp_handler.banner = "pyftpdlib %s based ftpd ready." % pyftpdlib.ftpserver.__ver__
+ ftp_handler.banner = ("pyftpdlib %s based ftpd ready." %
+ pyftpdlib.ftpserver.__ver__)
# Instantiate FTP server class and listen to 127.0.0.1:port
address = ('127.0.0.1', port)
« no previous file with comments | « net/proxy/proxy_service_unittest.cc ('k') | net/url_request/url_request_ftp_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698