diff options
author | cce <devnull@localhost> | 2005-12-29 18:44:53 +0000 |
---|---|---|
committer | cce <devnull@localhost> | 2005-12-29 18:44:53 +0000 |
commit | ed9585def36809315b53533fb89026fb621a607f (patch) | |
tree | e03fb1d7e24269751e3915d05dc09ec6bfcb361d /paste/fileapp.py | |
parent | cfd5e92779fb1da95a03db2b725dc8fbc701bfcb (diff) | |
download | paste-ed9585def36809315b53533fb89026fb621a607f.tar.gz |
- removing all entity headers for 304 response
- added abstract parse function to HTTPHeader
Diffstat (limited to 'paste/fileapp.py')
-rw-r--r-- | paste/fileapp.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/paste/fileapp.py b/paste/fileapp.py index ed77bac..57727cd 100644 --- a/paste/fileapp.py +++ b/paste/fileapp.py @@ -10,10 +10,11 @@ if-modified-since request header. import os, time, mimetypes from httpexceptions import HTTPBadRequest, HTTPForbidden, \ HTTPRequestRangeNotSatisfiable -from httpheaders import get_header, Expires, Range, \ +from httpheaders import get_header, Expires, Range, list_headers, \ ContentType, AcceptRanges, CacheControl, ContentDisposition, \ ContentLength, ContentRange, LastModified, IfModifiedSince + CACHE_SIZE = 4096 BLOCK_SIZE = 4096 * 16 @@ -94,10 +95,9 @@ class DataApp(object): try: client_clock = IfModifiedSince.parse(environ) if client_clock >= int(self.last_modified): - # the client has a recent copy - #@@: all entity headers should be removed, not just these - ContentLength.delete(headers) - ContentType.delete(headers) + # horribly inefficient, n^2 performance, yuck! + for head in list_headers(entity=True): + head.delete(headers) start_response('304 Not Modified',headers) return [''] # empty body except HTTPBadRequest, exce: @@ -112,7 +112,7 @@ class DataApp(object): return HTTPRequestRangeNotSatisfiable(( "Range request was made beyond the end of the content,\r\n" "which is %s long.\r\n Range: %s\r\n") % ( - self.content_length, range) + self.content_length, Range(environ)) ).wsgi_application(environ, start_response) content_length = 1 + (upper - lower) |