Created
December 22, 2016 05:07
-
-
Save shabunc/65e76f4428561ee4e4fc0967b5d2be57 to your computer and use it in GitHub Desktop.
minimal python content-length mismatch example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code snippet created specifically for http://stackoverflow.com/questions/41275918/how-to-get-neterr-content-length-mismatch-in-chrome-using-express