Django

Code

Ticket #6621: uri_fix.diff

File uri_fix.diff, 0.9 kB (added by Greg Thornton <xdissent@gmail.com>, 9 months ago)

patch for build_absolute_uri in HttpRequest to handle colons in URL paths

  • django/http/__init__.py

    old new  
    11import os 
     2import re 
    23from Cookie import SimpleCookie 
    34from pprint import pformat 
    45from urllib import urlencode 
     
    89from utils import * 
    910 
    1011RESERVED_CHARS="!*'();:@&=+$,/?%#[]" 
     12ABS_URI_RE = re.compile('^https?:') 
    1113 
    1214try: 
    1315    # The mod_python version is more efficient, so try importing it first. 
     
    7173        """ 
    7274        if not location: 
    7375            location = self.get_full_path() 
    74         if not ':' in location
     76        if not ABS_URI_RE.match(location)
    7577            current_uri = '%s://%s%s' % (self.is_secure() and 'https' or 'http', 
    7678                                         self.get_host(), self.path) 
    7779            location = urljoin(current_uri, location)