Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1159 closed defect (fixed)

Hard coded scheme in ticket notify emails (https vs. http)

Reported by: jaa-trac@… Owned by: Christopher Lenz
Priority: normal Milestone: 0.8.1
Component: general Version: 0.8
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

My trac installation is located at https://hostname:port/trac.cgi

Now when trac sends ticket change email notifications, it drops the https:// and replaces it with http://.

Attachments (0)

Change History (8)

comment:1 by jaa-trac@…, 19 years ago

The attached patch fixes it here. Cmlenz had following comments about this patch

13:29 < cmlenz_> btw, I've seen "if os.getenv('HTTPS') in ('on', '1')" used somewhere else... 
not sure why it should be "1" instead of "on",. but anyway,

This environment variable is documented here: Apache mod_ssl. Apache doc says that type is flag, so perhaps in ('on', 1) is a good idea (so far I have only seen 'on').

Index: trac/core.py
===================================================================
--- trac/core.py        (revision 1211)
+++ trac/core.py        (working copy)
@@ -359,8 +359,13 @@
         host = os.getenv('SERVER_NAME')
         proto_port = ''
         port = int(os.environ.get('SERVER_PORT', 80))
-        if port == 443:
-           proto = 'https'
+        # when you support Apache's way, you get it 60% right
+        if os.getenv('HTTPS') == 'on':
+            proto  = 'https'
+            if port != 443:
+               proto_port = ':%d' % port
+        elif port == 443:
+            proto = 'https'
         else:
            proto = 'http'
            if port != 80:

comment:2 by Christopher Lenz, 19 years ago

Milestone: 0.8.1
Owner: changed from Jonas Borgström to Christopher Lenz

comment:3 by Christopher Lenz, 19 years ago

Status: newassigned

comment:4 by Christopher Lenz, 19 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [1259], ported to stable in [1260]. Thanks!

comment:5 by jaa-trac@…, 19 years ago

Resolution: fixed
Status: closedreopened

In fact there is similar code section in ModPythonHanlder.py So this change should be also ported for it. Sorry that I missed it with my first patch.

comment:6 by Christopher Lenz, 19 years ago

I added similar code to the mod_python handler in [1276] (trunk). Can you verify whether it works? I have no SSL setup here for testing.

comment:7 by Christopher Lenz, 19 years ago

Resolution: fixed
Status: reopenedclosed

Just reopen when [1276] doesn't fix this issue.

comment:8 by jaa-trac@…, 19 years ago

Hello, with trac @ r1280 + mod_python + Brad's PgSQL patch, Tickets emails work ok with Trac over https on non-standard port. Thanks!

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.