Ticket #4685: check_protocol.2.diff
File check_protocol.2.diff, 957 bytes (added by , 17 years ago) |
---|
-
django/views/defaults.py
21 21 # if necessary. 22 22 23 23 # If the object actually defines a domain, we're done. 24 if absurl.startswith('http://') :24 if absurl.startswith('http://') or absurl.startswith('https://'): 25 25 return http.HttpResponseRedirect(absurl) 26 26 27 27 object_domain = None … … 61 61 # If all that malarkey found an object domain, use it; otherwise fall back 62 62 # to whatever get_absolute_url() returned. 63 63 if object_domain is not None: 64 return http.HttpResponseRedirect('http://%s%s' % (object_domain, absurl)) 64 protocol = request.is_secure() and 'https' or 'http' 65 return http.HttpResponseRedirect('%s://%s%s' % (protocol, object_domain, absurl)) 65 66 else: 66 67 return http.HttpResponseRedirect(absurl) 67 68