Default md_browser.py to listen just on localhost
It's a bit of security concern to expose a public server by default. The option is still maintained though, via --non-localhost Review-Url: https://codereview.chromium.org/2875633003 Cr-Commit-Position: refs/heads/master@{#471307}
This commit is contained in:
@ -36,10 +36,10 @@ def main(argv):
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
top_level = os.path.realpath(args.directory)
|
||||
server_address = ('localhost', args.port)
|
||||
s = Server(server_address, top_level)
|
||||
|
||||
s = Server(args.port, top_level)
|
||||
|
||||
print('Listening on http://localhost:%s/' % args.port)
|
||||
print('Listening on http://%s:%s/' % server_address)
|
||||
thread = None
|
||||
if args.file:
|
||||
path = os.path.realpath(args.file)
|
||||
@ -106,11 +106,9 @@ def _gitiles_slugify(value, _separator):
|
||||
|
||||
|
||||
class Server(SocketServer.TCPServer):
|
||||
def __init__(self, port, top_level):
|
||||
SocketServer.TCPServer.__init__(self, ('0.0.0.0', port), Handler)
|
||||
self.port = port
|
||||
def __init__(self, server_address, top_level):
|
||||
SocketServer.TCPServer.__init__(self, server_address, Handler)
|
||||
self.top_level = top_level
|
||||
self.retcode = None
|
||||
|
||||
def server_bind(self):
|
||||
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||
|
Reference in New Issue
Block a user