Top.Mail.Ru
ramou, posts by tag: code - LiveJournal — LiveJournal
? ?
About this Journal
Current Month
 1
2345678
9101112131415
16171819202122
23242526272829
3031
Image
ImageImage
May. 4th, 2008 @ 11:37 pm (no subject)
Tags:
It didn't work. Patches were weird. I compromised.

I detect if trac is being proxied. If it is, I assume it's being proxied for https and assign the scheme appropriately:

        """Reconstruct the absolute base URL of the application."""
        host = self.get_header('Host')
        scheme = self.scheme
        if self.get_header('X-Forwarded-Host'):
            scheme = 'https'
        if not host:
            # Missing host header, so reconstruct the host from the
            # server name and port
            default_port = {'http': 80, 'https': 443}
            if self.server_port and self.server_port != default_port[self.scheme]:
                host = '%s:%d' % (self.server_name, self.server_port)
            else:
                host = self.server_name
        return urlparse.urlunparse((schemeself.scheme, host, self.base_path, None,
                                    None, None))


(in web/api.py, if anyone cares)
About this Entry
cheshireImage
ImageImage
Image
ImageImage
Image
ImageImage
Image