Code

Ticket #6621: 6621.diff

File 6621.diff, 907 bytes (added by programmerq, 6 years ago)

Now applies cleanly to trunk

Line 
1diff --git a/django/http/__init__.py b/django/http/__init__.py
2index ef15479..e429696 100644
3--- a/django/http/__init__.py
4+++ b/django/http/__init__.py
5@@ -1,4 +1,5 @@
6 import os
7+import re
8 from Cookie import SimpleCookie, CookieError
9 from pprint import pformat
10 from urllib import urlencode
11@@ -17,6 +18,7 @@ from django.core.files import uploadhandler
12 from utils import *
13 
14 RESERVED_CHARS="!*'();:@&=+$,/?%#[]"
15+ABS_URI_RE = re.compile('^https?:')
16 
17 class Http404(Exception):
18     pass
19@@ -75,7 +77,7 @@ class HttpRequest(object):
20         """
21         if not location:
22             location = self.get_full_path()
23-        if not ':' in location:
24+        if not ABS_URI_RE.match(location):
25             current_uri = '%s://%s%s' % (self.is_secure() and 'https' or 'http',
26                                          self.get_host(), self.path)
27             location = urljoin(current_uri, location)