mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Patch #430706: Persistent connections in BaseHTTPServer.
This commit is contained in:
parent
8ec03e0528
commit
587c98c863
4 changed files with 145 additions and 40 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue