Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1687

Show
Ignore:
Timestamp:
06/23/07 21:45:12
Author:
fumanchu
Message:

Fix and tests for http.urljoin. Did not correctly handle blank PATH_INFO's.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/http.py

    r1671 r1687  
    2727 
    2828def urljoin(*atoms): 
    29     """Return the given path *atoms, joined into a single URL.""" 
    30     url = "/".join(atoms) 
     29    """Return the given path *atoms, joined into a single URL. 
     30     
     31    This will correctly join a SCRIPT_NAME and PATH_INFO into the 
     32    original URL, even if either atom is blank. 
     33    """ 
     34    url = "/".join([x for x in atoms if x]) 
    3135    while "//" in url: 
    3236        url = url.replace("//", "/") 
    33     return url 
     37    # Special-case the final url of "", and return "/" instead. 
     38    return url or "/" 
    3439 
    3540def protocol_from_http(protocol_str): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets