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

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

Issue 173049: Revert r23616 from 172. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/172/src/
Patch Set: Created 11 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 | « net/proxy/proxy_script_fetcher.cc ('k') | net/url_request/url_request.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Reverse-merged /trunk/src/net/tools/testserver/testserver.py:r14162,15308,16015,16808,21417
Merged /trunk/src/net/tools/testserver/testserver.py:r22067
OLDNEW
1 #!/usr/bin/python2.4 1 #!/usr/bin/python2.4
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2008 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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 return True 562 return True
563 563
564 def FileHandler(self): 564 def FileHandler(self):
565 """This handler sends the contents of the requested file. Wow, it's like 565 """This handler sends the contents of the requested file. Wow, it's like
566 a real webserver!""" 566 a real webserver!"""
567 567
568 prefix = self.server.file_root_url 568 prefix = self.server.file_root_url
569 if not self.path.startswith(prefix): 569 if not self.path.startswith(prefix):
570 return False 570 return False
571 571
572 # Consume a request body if present.
573 if self.command == 'POST':
574 self.rfile.read(int(self.headers.getheader('content-length')))
575
576 file = self.path[len(prefix):] 572 file = self.path[len(prefix):]
577 entries = file.split('/'); 573 entries = file.split('/');
578 path = os.path.join(self.server.data_dir, *entries) 574 path = os.path.join(self.server.data_dir, *entries)
579 if os.path.isdir(path): 575 if os.path.isdir(path):
580 path = os.path.join(path, 'index.html') 576 path = os.path.join(path, 'index.html')
581 577
582 if not os.path.isfile(path): 578 if not os.path.isfile(path):
583 print "File not found " + file + " full path:" + path 579 print "File not found " + file + " full path:" + path
584 self.send_error(404) 580 self.send_error(404)
585 return True 581 return True
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 help='Directory from which to read the files') 1103 help='Directory from which to read the files')
1108 option_parser.add_option('', '--https', dest='cert', 1104 option_parser.add_option('', '--https', dest='cert',
1109 help='Specify that https should be used, specify ' 1105 help='Specify that https should be used, specify '
1110 'the path to the cert containing the private key ' 1106 'the path to the cert containing the private key '
1111 'the server should use') 1107 'the server should use')
1112 option_parser.add_option('', '--file-root-url', default='/files/', 1108 option_parser.add_option('', '--file-root-url', default='/files/',
1113 help='Specify a root URL for files served.') 1109 help='Specify a root URL for files served.')
1114 options, args = option_parser.parse_args() 1110 options, args = option_parser.parse_args()
1115 1111
1116 sys.exit(main(options, args)) 1112 sys.exit(main(options, args))
OLDNEW
« no previous file with comments | « net/proxy/proxy_script_fetcher.cc ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698