Skip to content

Instantly share code, notes, and snippets.

Created August 3, 2015 15:32
Show Gist options
  • Save anonymous/addad9f51781a6cd2cf9 to your computer and use it in GitHub Desktop.
Save anonymous/addad9f51781a6cd2cf9 to your computer and use it in GitHub Desktop.
import time
from wsgiref.simple_server import make_server
def simple_app(environ, start_response):
status = '200 OK'
headers = [('Content-type', 'text/html')]
start_response(status, headers)
yield u"""
<!DOCTYPE html>
<!-- 1024 bytes:
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
123456789012345678901234567890123456789012345678901234567890123
-->
è
""".encode('utf8')
time.sleep(2)
yield u"<meta charset=utf-8>é".encode('utf8')
httpd = make_server('', 8000, simple_app)
print("Listening on port 8000....")
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment