diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2011-10-30 19:39:24 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2011-10-30 19:39:24 (GMT) |
commit | 75861df9ab2b5492406ce866f5a24989a00a24b9 (patch) | |
tree | f6823a412379e5d9c91c612a8662652fc20cd3b4 /Lib/xmlrpc/server.py | |
parent | 2b6403e5d14a407acb744cd1da58d1a66c412050 (diff) | |
download | cpython-75861df9ab2b5492406ce866f5a24989a00a24b9.zip cpython-75861df9ab2b5492406ce866f5a24989a00a24b9.tar.gz cpython-75861df9ab2b5492406ce866f5a24989a00a24b9.tar.bz2 |
Fix User-Agent for the xmlrpc.client, and catch KeyboardInterrupt for the standalone xmlrpc.server.
Diffstat (limited to 'Lib/xmlrpc/server.py')
-rw-r--r-- | Lib/xmlrpc/server.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py index 72f3bfc..4fc8a15 100644 --- a/Lib/xmlrpc/server.py +++ b/Lib/xmlrpc/server.py @@ -956,8 +956,13 @@ class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler, if __name__ == '__main__': - print('Running XML-RPC server on port 8000') server = SimpleXMLRPCServer(("localhost", 8000)) server.register_function(pow) server.register_function(lambda x,y: x+y, 'add') - server.serve_forever() + print('Serving XML-RPC on localhost port 8000') + try: + server.serve_forever() + except KeyboardInterrupt: + print("\nKeyboard interrupt received, exiting.") + server.server_close() + sys.exit(0) |