summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-07-29 17:40:33 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-07-29 17:40:33 +0200
commitea31bb243b398e73f4a4bda46c1911ab0487ff3f (patch)
tree5ee5fc4c2557c26643fa861febaf961dfa0f68ec
parent0e936a1e55d0168b8d4af5e396bc8a22c7d260e2 (diff)
Added support for X-Sendfile.
-rwxr-xr-xfbin.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/fbin.py b/fbin.py
index bae6434..e0d70d8 100755
--- a/fbin.py
+++ b/fbin.py
@@ -143,6 +143,9 @@ class Application(object):
return []
mime = mimetypes.guess_type(file.filename, strict = False)[0] or 'application/octet-stream'
+ if settings.use_xsendfile:
+ start_response('200 OK', [('X-Sendfile', filename.encode('utf8')), ('Last-Modified', file.date.strftime(rfc1123_format))])
+ return []
start_response('200 OK', [('Content-Type', mime), ('Content-Length', str(os.path.getsize(filename))),
('Last-Modified', file.date.strftime(rfc1123_format))])