Code

Ticket #4685: check_protocol.diff

File check_protocol.diff, 669 bytes (added by treborhudson@…, 7 years ago)

Patch attempt, needs testing

Line 
1Index: django/views/defaults.py
2===================================================================
3--- django/views/defaults.py    (revision 5554)
4+++ django/views/defaults.py    (working copy)
5@@ -61,7 +61,8 @@
6     # If all that malarkey found an object domain, use it; otherwise fall back
7     # to whatever get_absolute_url() returned.
8     if object_domain is not None:
9-        return http.HttpResponseRedirect('http://%s%s' % (object_domain, absurl))
10+        protocol = request.is_secure() and 'https' or 'http'
11+        return http.HttpResponseRedirect('%s://%s%s' % (protocol, object_domain, absurl))
12     else:
13         return http.HttpResponseRedirect(absurl)
14