summaryrefslogtreecommitdiff
path: root/lib/python2.7/site-packages/django/middleware/http.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python2.7/site-packages/django/middleware/http.py')
-rw-r--r--lib/python2.7/site-packages/django/middleware/http.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/python2.7/site-packages/django/middleware/http.py b/lib/python2.7/site-packages/django/middleware/http.py
deleted file mode 100644
index 5a46e04..0000000
--- a/lib/python2.7/site-packages/django/middleware/http.py
+++ /dev/null
@@ -1,35 +0,0 @@
-from django.utils.http import http_date, parse_http_date_safe
-
-class ConditionalGetMiddleware(object):
- """
- Handles conditional GET operations. If the response has a ETag or
- Last-Modified header, and the request has If-None-Match or
- If-Modified-Since, the response is replaced by an HttpNotModified.
-
- Also sets the Date and Content-Length response-headers.
- """
- def process_response(self, request, response):
- response['Date'] = http_date()
- if not response.streaming and not response.has_header('Content-Length'):
- response['Content-Length'] = str(len(response.content))
-
- if response.has_header('ETag'):
- if_none_match = request.META.get('HTTP_IF_NONE_MATCH')
- if if_none_match == response['ETag']:
- # Setting the status is enough here. The response handling path
- # automatically removes content for this status code (in
- # http.conditional_content_removal()).
- response.status_code = 304
-
- if response.has_header('Last-Modified'):
- if_modified_since = request.META.get('HTTP_IF_MODIFIED_SINCE')
- if if_modified_since is not None:
- if_modified_since = parse_http_date_safe(if_modified_since)
- if if_modified_since is not None:
- last_modified = parse_http_date_safe(response['Last-Modified'])
- if last_modified is not None and last_modified <= if_modified_since:
- # Setting the status code is enough here (same reasons as
- # above).
- response.status_code = 304
-
- return response