summaryrefslogtreecommitdiff
path: root/paste/fileapp.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2006-07-17 16:10:58 +0000
committerianb <devnull@localhost>2006-07-17 16:10:58 +0000
commit30af1b988a14b2d73354301142274510e86d57d7 (patch)
treea66ea97012fd09082a9c2446befba613a2b4566e /paste/fileapp.py
parentd959df3d5b7eb6c0efcbcc484823ee08628b4b0c (diff)
downloadpaste-30af1b988a14b2d73354301142274510e86d57d7.tar.gz
Added tests for file-related conditional requests. Added support for If-None-Match to DataApp. Added parsing support for multi-value headers.
Diffstat (limited to 'paste/fileapp.py')
-rw-r--r--paste/fileapp.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/paste/fileapp.py b/paste/fileapp.py
index d14cf26..2a8ef35 100644
--- a/paste/fileapp.py
+++ b/paste/fileapp.py
@@ -87,7 +87,8 @@ class DataApp(object):
def __call__(self, environ, start_response):
headers = self.headers[:]
- ETAG.update(headers, self.last_modified)
+ current_etag = str(self.last_modified)
+ ETAG.update(headers, current_etag)
if self.expires is not None:
EXPIRES.update(headers, delta=self.expires)
@@ -102,6 +103,19 @@ class DataApp(object):
except HTTPBadRequest, exce:
return exce.wsgi_application(environ, start_response)
+ try:
+ client_etags = IF_NONE_MATCH.parse(environ)
+ if client_etags:
+ for etag in client_etags:
+ if etag == current_etag or etag == '*':
+ # horribly inefficient, n^2 performance, yuck!
+ for head in list_headers(entity=True):
+ head.delete(headers)
+ start_response('304 Not Modified', headers)
+ return ['']
+ except HTTPBadRequest, exce:
+ return exce.wsgi_application(environ, start_response)
+
(lower,upper) = (0, self.content_length - 1)
range = RANGE.parse(environ)
if range and 'bytes' == range[0] and 1 == len(range[1]):