/usr/share/doc/python-gevent-doc/examples/httpserver.py is in python-gevent-doc 0.13.6-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/usr/bin/python
"""HTTP server example.
Uses libevent API directly and thus may be dangerous.
WSGI interface is a safer choice, see examples/wsgiserver.py.
"""
from gevent import http
def callback(request):
print request
if request.uri == '/':
request.add_output_header('Content-Type', 'text/html')
request.send_reply(200, "OK", '<b>hello world</b>')
else:
request.add_output_header('Content-Type', 'text/html')
request.send_reply(404, "Not Found", "<h1>Not Found</h1>")
print 'Serving on 8088...'
http.HTTPServer(('0.0.0.0', 8088), callback).serve_forever()
|