Edgewall Software

Changes between Initial Version and Version 1 of Ticket #2553


Ignore:
Timestamp:
Jan 4, 2006, 11:07:37 AM (14 years ago)
Author:
Christian Boos
Comment:

One could use the Referer: header, if present.

Index: standalone.py
===================================================================
--- standalone.py       (revision 2721)
+++ standalone.py       (working copy)
@@ -325,21 +325,22 @@
         Request.__init__(self)
         self.__handler = handler
         self.__status_sent = False
-
-        self.scheme = 'http'
+        headers = handler.headers
+        self.scheme = 'http' # as default, but use Referer: header if
present
+        if headers.has_key('Referer'):
+            self.scheme = headers['Referer'].split(':')[0]
         self.method = self.__handler.command
         self.remote_addr = str(self.__handler.client_address[0])
         self.server_name = self.__handler.server.server_name
         self.server_port = self.__handler.server.server_port
-        if self.__handler.headers.has_key('Cookie'):
-            self.incookie.load(self.__handler.headers['Cookie'])
+        if headers.has_key('Cookie'):
+            self.incookie.load(headers['Cookie'])
         self.cgi_location = '/' + project_name
         self.idx_location = '/'
         environ = {'REQUEST_METHOD': self.method,
                    'QUERY_STRING': query_string}
-        headers = self.__handler.headers
         if self.method in ('GET', 'HEAD'):
             headers = None
         self.args = TracFieldStorage(self.__handler.rfile,
environ=environ,

Thoughts?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2553

    • Property Owner changed from Jonas Borgström to Christian Boos
    • Property Status newassigned
    • Property Milestone0.9.4
  • Ticket #2553 – Description

    initial v1  
    1 Running tracd through stunnel, I access trac via a https://url/trac.Everything works fine until I change something (confirm a wiki edit, adda new ticket, login, etc.) and the url forwards to http://url/tracinstead of https.To fix this, I changed the 'self.scheme = 'http'' in TracHTTPRequest instandalone.py to self.scheme='https'. But I imagine this shouldautodetect in some way.
     1Running tracd through stunnel, I access trac via a https://url/trac.Everything works fine until I change something (confirm a wiki edit, add anew ticket, login, etc.) and the url forwards to http://url/trac insteadof https.To fix this, I changed the `self.scheme = 'http'` in TracHTTPRequest instandalone.py to `self.scheme='https'`. But I imagine this shouldautodetect in some way.