Module: sems Branch: master Commit: 7ec746af86b3e2c5ec4ef358d14df3cad8bfe80f URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=7ec746af86b3e2c5ec4ef358d14df3cad8bfe80f
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Wed Apr 18 15:00:07 2012 +0200 mobile_push: test example server --- apps/mobile_push/load_test/example_server.py | 36 ++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/apps/mobile_push/load_test/example_server.py b/apps/mobile_push/load_test/example_server.py new file mode 100644 index 0000000..b564308 --- /dev/null +++ b/apps/mobile_push/load_test/example_server.py @@ -0,0 +1,36 @@ +import time +import BaseHTTPServer + + +HOST_NAME = '127.0.0.1' # !!!REMEMBER TO CHANGE THIS!!! +PORT_NUMBER = 8000 # Maybe set this to 9000. + + +class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): + def do_HEAD(s): + s.send_response(200) + s.send_header("Content-type", "text/html") + s.end_headers() + def do_GET(s): + """Respond to a GET request.""" + s.send_response(200) + s.send_header("Content-type", "text/html") + s.end_headers() + s.wfile.write("<html><head><title>Title goes here.</title></head>") + s.wfile.write("<body><p>This is a test.</p>") + # If someone went to "http://something.somewhere.net/foo/bar/", + # then s.path equals "/foo/bar/". + s.wfile.write("<p>You accessed path: %s</p>" % s.path) + s.wfile.write("</body></html>") + +if __name__ == '__main__': + server_class = BaseHTTPServer.HTTPServer + httpd = server_class((HOST_NAME, PORT_NUMBER), MyHandler) + print time.asctime(), "Server Starts - %s:%s" % (HOST_NAME, PORT_NUMBER) + try: + httpd.serve_forever() + except KeyboardInterrupt: + pass + httpd.server_close() + print time.asctime(), "Server Stops - %s:%s" % (HOST_NAME, PORT_NUMBER) + _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
