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

Changeset 13

Show
Ignore:
Timestamp:
11/23/04 07:00:39
Author:
rdelon
Message:

Fixed ticket #29

Files:

Legend:

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

    r8 r13  
    2323    if not newUrl.startswith('http://') and not newUrl.startswith('https://'): 
    2424        # If newUrl is not canonical, we must make it canonical 
    25         if newUrl[0] == '/': 
    26             # URL was absolute: we just add the request.base in front of it 
     25        if newUrl.startswith('/'): 
     26            # newUrl was absolute: 
     27            # we just add request.base in front of it 
    2728            newUrl = cpg.request.base + newUrl 
    2829        else: 
    29             # URL was relative 
    30             if cpg.request.browserUrl == cpg.request.base: 
    31                 # browserUrl is request.base 
    32                 newUrl = cpg.request.base + '/' + newUrl 
    33             else: 
    34                 newUrl = cpg.request.browserUrl[:i+1] + newUrl 
     30            # newUrl was relative: 
     31            # we remove the last bit from browserUrl and add newUrl to it 
     32            i = cpg.request.browserUrl.rfind('/') 
     33            newUrl = cpg.request.browserUrl[:i+1] + newUrl 
    3534    cpg.response.headerMap['Status'] = 302 
    3635    cpg.response.headerMap['Location'] = newUrl 

Hosted by WebFaction

Log in as guest/cpguest to create tickets