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

Side by Side Diff: net/tools/testserver/testserver.py

Issue 3163041: Disable request logging in test HTTP server to declutter log output. (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """This is a simple HTTP server used for testing Chrome. 6 """This is a simple HTTP server used for testing Chrome.
7 7
8 It supports several test URLs, as specified by the handlers in TestPageHandler. 8 It supports several test URLs, as specified by the handlers in TestPageHandler.
9 It defaults to living on localhost:8888. 9 It defaults to living on localhost:8888.
10 It can use https if you specify the flag --https=CERT where CERT is the path 10 It can use https if you specify the flag --https=CERT where CERT is the path
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 'jpeg' : 'image/jpeg', 155 'jpeg' : 'image/jpeg',
156 'jpg' : 'image/jpeg', 156 'jpg' : 'image/jpeg',
157 'xml' : 'text/xml' 157 'xml' : 'text/xml'
158 } 158 }
159 self._default_mime_type = 'text/html' 159 self._default_mime_type = 'text/html'
160 160
161 BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, request, 161 BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, request,
162 client_address, 162 client_address,
163 socket_server) 163 socket_server)
164 164
165 def log_request(self, *args, **kwargs):
166 # Disable request logging to declutter test log output.
167 pass
168
165 def _ShouldHandleRequest(self, handler_name): 169 def _ShouldHandleRequest(self, handler_name):
166 """Determines if the path can be handled by the handler. 170 """Determines if the path can be handled by the handler.
167 171
168 We consider a handler valid if the path begins with the 172 We consider a handler valid if the path begins with the
169 handler name. It can optionally be followed by "?*", "/*". 173 handler name. It can optionally be followed by "?*", "/*".
170 """ 174 """
171 175
172 pattern = re.compile('%s($|\?|/).*' % handler_name) 176 pattern = re.compile('%s($|\?|/).*' % handler_name)
173 return pattern.match(self.path) 177 return pattern.match(self.path)
174 178
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 option_parser.add_option('', '--file-root-url', default='/files/', 1321 option_parser.add_option('', '--file-root-url', default='/files/',
1318 help='Specify a root URL for files served.') 1322 help='Specify a root URL for files served.')
1319 option_parser.add_option('', '--never-die', default=False, 1323 option_parser.add_option('', '--never-die', default=False,
1320 action="store_true", 1324 action="store_true",
1321 help='Prevent the server from dying when visiting ' 1325 help='Prevent the server from dying when visiting '
1322 'a /kill URL. Useful for manually running some ' 1326 'a /kill URL. Useful for manually running some '
1323 'tests.') 1327 'tests.')
1324 options, args = option_parser.parse_args() 1328 options, args = option_parser.parse_args()
1325 1329
1326 sys.exit(main(options, args)) 1330 sys.exit(main(options, args))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698