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

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

Issue 62145: Yet another scrape atttempt (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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/base/ssl_test_util.cc ('k') | net/url_request/url_request_unittest.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 13436)
+++ net/tools/testserver/testserver.py (working copy)
@@ -565,13 +565,15 @@
"""This handler sends the contents of the requested file. Wow, it's like
a real webserver!"""
- prefix='/files/'
+ prefix = self.server.file_root_url
if not self.path.startswith(prefix):
return False
file = self.path[len(prefix):]
entries = file.split('/');
path = os.path.join(self.server.data_dir, *entries)
+ if os.path.isdir(path):
+ path = os.path.join(path, 'index.html')
if not os.path.isfile(path):
print "File not found " + file + " full path:" + path
@@ -1047,6 +1049,7 @@
print 'HTTP server started on port %d...' % port
server.data_dir = MakeDataDir()
+ server.file_root_url = options.file_root_url
MakeDumpDir(server.data_dir)
# means FTP Server
@@ -1102,6 +1105,8 @@
help='Specify that https should be used, specify '
'the path to the cert containing the private key '
'the server should use')
+ option_parser.add_option('', '--file-root-url', default='/files/',
+ help='Specify a root URL for files served.')
options, args = option_parser.parse_args()
sys.exit(main(options, args))
« no previous file with comments | « net/base/ssl_test_util.cc ('k') | net/url_request/url_request_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698