Skip to content

Instantly share code, notes, and snippets.

@shabunc
Created December 22, 2016 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shabunc/65e76f4428561ee4e4fc0967b5d2be57 to your computer and use it in GitHub Desktop.
Save shabunc/65e76f4428561ee4e4fc0967b5d2be57 to your computer and use it in GitHub Desktop.
minimal python content-length mismatch example
import SimpleHTTPServer
import SocketServer
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
PORT = 8000
class myHandler(BaseHTTPRequestHandler):
#Handler for the GET requests
def do_GET(self):
self.send_response(200)
self.send_header('Content-Length', 7)
self.end_headers()
# Send the html message
self.wfile.write("ABCDEFGHIJKLMNOP")
return
httpd = SocketServer.TCPServer(("", PORT), myHandler)
print "http://127.0.0.1:{}".format(PORT)
httpd.serve_forever()
@shabunc
Copy link
Author

shabunc commented Dec 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment