Commit 40bd5a05 authored by Vincent Pelletier's avatar Vincent Pelletier

http: Use print for stderr too.

Avoids hardcoding newline char.
parent 78162dee
...@@ -181,13 +181,14 @@ class CaucaseSSLWSGIRequestHandler(CaucaseWSGIRequestHandler): ...@@ -181,13 +181,14 @@ class CaucaseSSLWSGIRequestHandler(CaucaseWSGIRequestHandler):
def log_message(self, format, *args): def log_message(self, format, *args):
# Note: compared to BaseHTTPHandler, logs the client certificate serial as # Note: compared to BaseHTTPHandler, logs the client certificate serial as
# user name. # user name.
sys.stderr.write( print(
"%s - %s [%s] %s\n" % ( "%s - %s [%s] %s" % (
self.client_address[0], self.client_address[0],
self.ssl_client_cert_serial, self.ssl_client_cert_serial,
self.log_date_time_string(), self.log_date_time_string(),
format % args, format % args,
) ),
file=sys.stderr,
) )
# pylint: enable=redefined-builtin # pylint: enable=redefined-builtin
...@@ -662,12 +663,13 @@ def main(argv=None, until=utils.until): ...@@ -662,12 +663,13 @@ def main(argv=None, until=utils.until):
if host in known_host_set: if host in known_host_set:
continue continue
known_host_set.add(host) known_host_set.add(host)
sys.stderr.write( print(
'Listening on [%s]:%i-%i\n' % ( 'Listening on [%s]:%i-%i' % (
host, host,
http_port, http_port,
https_port, https_port,
), ),
file=sys.stderr,
) )
http_list.append( http_list.append(
make_server( make_server(
...@@ -780,7 +782,7 @@ def main(argv=None, until=utils.until): ...@@ -780,7 +782,7 @@ def main(argv=None, until=utils.until):
except utils.SleepInterrupt: except utils.SleepInterrupt:
pass pass
finally: finally:
sys.stderr.write('Exiting\n') print('Exiting', file=sys.stderr)
for server in itertools.chain(http_list, https_list): for server in itertools.chain(http_list, https_list):
server.server_close() server.server_close()
server.shutdown() server.shutdown()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment