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

Side by Side Diff: mojo/devtools/common/devtoolslib/http_server.py

Issue 1433353007: Drop default port number in `http_server.py` and `shell.py`. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import atexit 5 import atexit
6 import datetime 6 import datetime
7 import email.utils 7 import email.utils
8 import errno 8 import errno
9 import hashlib 9 import hashlib
10 import logging 10 import logging
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 pass 200 pass
201 201
202 def __del__(self): 202 def __del__(self):
203 if self.gzipped_file_name: 203 if self.gzipped_file_name:
204 os.remove(self.gzipped_file_name) 204 os.remove(self.gzipped_file_name)
205 205
206 RequestHandler.protocol_version = 'HTTP/1.1' 206 RequestHandler.protocol_version = 'HTTP/1.1'
207 return RequestHandler 207 return RequestHandler
208 208
209 209
210 def start_http_server(mappings, host_port=0): 210 def start_http_server(mappings, host_port):
211 """Starts an http server serving files from |local_dir_path| on |host_port|. 211 """Starts an http server serving files from |local_dir_path| on |host_port|.
212 212
213 Args: 213 Args:
214 mappings: List of tuples (prefix, local_base_path_list) mapping URLs that 214 mappings: List of tuples (prefix, local_base_path_list) mapping URLs that
215 start with |prefix| to one or more local directories enumerated in 215 start with |prefix| to one or more local directories enumerated in
216 |local_base_path_list|. The prefixes should skip the leading slash. 216 |local_base_path_list|. The prefixes should skip the leading slash.
217 The first matching prefix and the first location that contains the 217 The first matching prefix and the first location that contains the
218 requested file will be used each time. 218 requested file will be used each time.
219 host_port: Port on the host machine to run the server on. Pass 0 to use a 219 host_port: Port on the host machine to run the server on. Pass 0 to use a
220 system-assigned port. 220 system-assigned port.
(...skipping 23 matching lines...) Expand all
244 'lsof -i :%d | grep LISTEN | awk \'{print $2}\' | xargs kill -9' 244 'lsof -i :%d | grep LISTEN | awk \'{print $2}\' | xargs kill -9'
245 % host_port) 245 % host_port)
246 else: 246 else:
247 find_cmd = 'fuser %d/tcp' % host_port 247 find_cmd = 'fuser %d/tcp' % host_port
248 terminate_cmd = 'fuser -k %d/tcp' % host_port 248 terminate_cmd = 'fuser -k %d/tcp' % host_port
249 print (' Run `%s` to find out which process is using the port;' 249 print (' Run `%s` to find out which process is using the port;'
250 % find_cmd) 250 % find_cmd)
251 print (' or `%s` terminate it.' % terminate_cmd) 251 print (' or `%s` terminate it.' % terminate_cmd)
252 print '---' 252 print '---'
253 raise 253 raise
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/android_shell.py ('k') | mojo/devtools/common/devtoolslib/http_server_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698