Commits

kender  committed 0773798

fix a protocol bug in baseurlfilter

  • Participants
  • Parent commits 7e72621
  • Branches cherrypy

Comments (0)

Files changed (1)

File lib/filter/baseurlfilter.py

 
     def afterRequestHeader(self):
         if self.useXForwardedHost:
-            newBaseUrl = 'http://' + cpg.request.headerMap.get(
-                "X-Forwarded-Host", self.baseUrl)
+            newBaseUrl = cpg.request.headerMap.get("X-Forwarded-Host", self.baseUrl)
         else:
             newBaseUrl = self.baseUrl
+	if newBaseUrl.find("://") == -1:
+	    # add http:// or https:// if needed	
+	    newBaseUrl = cpg.request.base[:cpg.request.base.find("://")] + "://" + newBaseUrl
 
         cpg.request.browserUrl = cpg.request.browserUrl.replace(
             cpg.request.base, newBaseUrl)