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

Changeset 1980

Show
Ignore:
Timestamp:
06/08/08 16:56:25
Author:
fumanchu
Message:

Fix for #782 (X-Forwarded-Ssl).

Files:

Legend:

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

    r1938 r1980  
    116116     
    117117    if scheme: 
    118         scheme = request.headers.get(scheme, None) 
     118        s = request.headers.get(scheme, None) 
     119        if s == 'on' and 'ssl' in scheme.lower(): 
     120            # This handles e.g. webfaction's 'X-Forwarded-Ssl: on' header 
     121            scheme = 'https' 
     122        else: 
     123            # This is for lighttpd/pound/Mongrel's 'X-Forwarded-Proto: https' 
     124            scheme = s 
    119125    if not scheme: 
    120126        scheme = request.base[:request.base.find("://")] 
  • trunk/cherrypy/test/test_proxy.py

    r1788 r1980  
    4646        base.exposed = True 
    4747         
     48        def ssl(self): 
     49            return cherrypy.request.base 
     50        ssl.exposed = True 
     51        ssl._cp_config = {'tools.proxy.scheme': 'X-Forwarded-Ssl'} 
     52         
    4853        def newurl(self): 
    4954            return ("Browse to <a href='%s'>this page</a>." 
     
    8792        self.assertBody("https://www.mydomain.test") 
    8893         
     94        # Test X-Forwarded-Ssl (webfaction?) 
     95        self.getPage("/ssl", headers=[('X-Forwarded-Ssl', 'on')]) 
     96        self.assertBody("https://www.mydomain.test") 
     97         
    8998        # Test cherrypy.url() 
    9099        for sn in script_names: 

Hosted by WebFaction

Log in as guest/cpguest to create tickets