Loading django/core/handlers/base.py +0 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ logger = logging.getLogger('django.request') class BaseHandler(object): # Changes that are always applied to a response (in this order). response_fixes = [ http.fix_location_header, http.conditional_content_removal, ] Loading django/http/__init__.py +3 −3 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from django.http.response import ( HttpResponseNotFound, HttpResponseNotAllowed, HttpResponseGone, HttpResponseServerError, Http404, BadHeaderError, JsonResponse, ) from django.http.utils import fix_location_header, conditional_content_removal from django.http.utils import conditional_content_removal __all__ = [ 'SimpleCookie', 'parse_cookie', 'HttpRequest', 'QueryDict', Loading @@ -17,6 +17,6 @@ __all__ = [ 'HttpResponsePermanentRedirect', 'HttpResponseNotModified', 'HttpResponseBadRequest', 'HttpResponseForbidden', 'HttpResponseNotFound', 'HttpResponseNotAllowed', 'HttpResponseGone', 'HttpResponseServerError', 'Http404', 'BadHeaderError', 'fix_location_header', 'JsonResponse', 'FileResponse', 'conditional_content_removal', 'Http404', 'BadHeaderError', 'JsonResponse', 'FileResponse', 'conditional_content_removal', ] django/http/utils.py +0 −13 Original line number Diff line number Diff line Loading @@ -9,19 +9,6 @@ Functions that modify an HTTP request or response in some way. # universally applicable. def fix_location_header(request, response): """ Ensures that we always use an absolute URI in any location header in the response. This is required by RFC 2616, section 14.30. Code constructing response objects is free to insert relative paths, as this function converts them to absolute paths. """ if 'Location' in response: response['Location'] = request.build_absolute_uri(response['Location']) return response def conditional_content_removal(request, response): """ Removes the content of responses for HEAD requests, 1xx, 204 and 304 Loading django/middleware/common.py +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ class CommonMiddleware(object): if new_url == old_url: # No redirects required. return if new_url[0]: if new_url[0] != old_url[0]: newurl = "%s://%s%s" % ( request.scheme, new_url[0], urlquote(new_url[1])) Loading django/middleware/locale.py +6 −10 Original line number Diff line number Diff line Loading @@ -40,17 +40,13 @@ class LocaleMiddleware(object): if path_valid: script_prefix = get_script_prefix() language_url = "%s://%s%s" % ( request.scheme, request.get_host(), # insert language after the script prefix and before the # Insert language after the script prefix and before the # rest of the URL request.get_full_path().replace( language_url = request.get_full_path().replace( script_prefix, '%s%s/' % (script_prefix, language), 1 ) ) return self.response_redirect_class(language_url) if not (self.is_language_prefix_patterns_used Loading Loading
django/core/handlers/base.py +0 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ logger = logging.getLogger('django.request') class BaseHandler(object): # Changes that are always applied to a response (in this order). response_fixes = [ http.fix_location_header, http.conditional_content_removal, ] Loading
django/http/__init__.py +3 −3 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ from django.http.response import ( HttpResponseNotFound, HttpResponseNotAllowed, HttpResponseGone, HttpResponseServerError, Http404, BadHeaderError, JsonResponse, ) from django.http.utils import fix_location_header, conditional_content_removal from django.http.utils import conditional_content_removal __all__ = [ 'SimpleCookie', 'parse_cookie', 'HttpRequest', 'QueryDict', Loading @@ -17,6 +17,6 @@ __all__ = [ 'HttpResponsePermanentRedirect', 'HttpResponseNotModified', 'HttpResponseBadRequest', 'HttpResponseForbidden', 'HttpResponseNotFound', 'HttpResponseNotAllowed', 'HttpResponseGone', 'HttpResponseServerError', 'Http404', 'BadHeaderError', 'fix_location_header', 'JsonResponse', 'FileResponse', 'conditional_content_removal', 'Http404', 'BadHeaderError', 'JsonResponse', 'FileResponse', 'conditional_content_removal', ]
django/http/utils.py +0 −13 Original line number Diff line number Diff line Loading @@ -9,19 +9,6 @@ Functions that modify an HTTP request or response in some way. # universally applicable. def fix_location_header(request, response): """ Ensures that we always use an absolute URI in any location header in the response. This is required by RFC 2616, section 14.30. Code constructing response objects is free to insert relative paths, as this function converts them to absolute paths. """ if 'Location' in response: response['Location'] = request.build_absolute_uri(response['Location']) return response def conditional_content_removal(request, response): """ Removes the content of responses for HEAD requests, 1xx, 204 and 304 Loading
django/middleware/common.py +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ class CommonMiddleware(object): if new_url == old_url: # No redirects required. return if new_url[0]: if new_url[0] != old_url[0]: newurl = "%s://%s%s" % ( request.scheme, new_url[0], urlquote(new_url[1])) Loading
django/middleware/locale.py +6 −10 Original line number Diff line number Diff line Loading @@ -40,17 +40,13 @@ class LocaleMiddleware(object): if path_valid: script_prefix = get_script_prefix() language_url = "%s://%s%s" % ( request.scheme, request.get_host(), # insert language after the script prefix and before the # Insert language after the script prefix and before the # rest of the URL request.get_full_path().replace( language_url = request.get_full_path().replace( script_prefix, '%s%s/' % (script_prefix, language), 1 ) ) return self.response_redirect_class(language_url) if not (self.is_language_prefix_patterns_used Loading