diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2002-03-17 18:37:22 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2002-03-17 18:37:22 (GMT) |
commit | 587c98c863ca11d779a63f559d435c4c8f30eb93 (patch) | |
tree | 7a143ac8cd72445a5f5845e5bdcebfe7368f9b22 /Lib/SimpleHTTPServer.py | |
parent | 8ec03e0528d93c6b7cc9cf07d2f24e541661ba70 (diff) | |
download | cpython-587c98c863ca11d779a63f559d435c4c8f30eb93.zip cpython-587c98c863ca11d779a63f559d435c4c8f30eb93.tar.gz cpython-587c98c863ca11d779a63f559d435c4c8f30eb93.tar.bz2 |
Patch #430706: Persistent connections in BaseHTTPServer.
Diffstat (limited to 'Lib/SimpleHTTPServer.py')
-rw-r--r-- | Lib/SimpleHTTPServer.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/SimpleHTTPServer.py b/Lib/SimpleHTTPServer.py index 20ed116..2caa89d 100644 --- a/Lib/SimpleHTTPServer.py +++ b/Lib/SimpleHTTPServer.py @@ -82,6 +82,7 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): return None self.send_response(200) self.send_header("Content-type", ctype) + self.send_header("Content-Length", str(os.fstat(f.fileno())[6])) self.end_headers() return f @@ -115,9 +116,11 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): # Note: a link to a directory displays with @ and links with / f.write('<li><a href="%s">%s</a>\n' % (linkname, displayname)) f.write("</ul>\n<hr>\n") + length = f.tell() f.seek(0) self.send_response(200) self.send_header("Content-type", "text/html") + self.send_header("Content-Length", str(length)) self.end_headers() return f |