Commit 217ac595 authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis Committed by Christos Stavrakakis
Browse files

wheezy: is_hop_by_hop has been removed from Django

Implement our own is_hop_by_hop function.
parent 34c783c8
......@@ -31,7 +31,19 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
from django.core.servers.basehttp import is_hop_by_hop
try:
from django.core.servers.basehttp import is_hop_by_hop
except ImportError:
# Removed in Django 1.4
_hop_headers = {
'connection': 1, 'keep-alive': 1, 'proxy-authenticate': 1,
'proxy-authorization': 1, 'te': 1, 'trailers': 1,
'transfer-encoding': 1, 'upgrade': 1
}
def is_hop_by_hop(header_name):
"""Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header"""
return header_name.lower() in _hop_headers
def fix_header(k, v):
......@@ -43,4 +55,4 @@ def fix_header(k, v):
def forward_header(k):
return k.upper() not in ['HOST', 'CONTENT_LENGTH', 'CONTENT_TYPE'] and \
not is_hop_by_hop(k) and not '.' in k
not is_hop_by_hop(k) and not '.' in k
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment