Edgewall Software

Ticket #1159 (closed defect: fixed)

Opened 4 years ago

Last modified 2 years ago

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

Reported by: jaa-trac@… Owned by: cmlenz
Priority: normal Milestone: 0.8.1
Component: general Version: 0.8
Severity: normal Keywords:
Cc:

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

Change History

Changed 4 years ago by jaa-trac@…

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:

Changed 4 years ago by cmlenz

  • owner changed from jonas to cmlenz
  • milestone set to 0.8.1

Changed 4 years ago by cmlenz

  • status changed from new to assigned

Changed 4 years ago by cmlenz

  • status changed from assigned to closed
  • resolution set to fixed

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

Changed 4 years ago by jaa-trac@…

  • status changed from closed to reopened
  • resolution fixed deleted

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.

Changed 4 years ago by cmlenz

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.

Changed 4 years ago by cmlenz

  • status changed from reopened to closed
  • resolution set to fixed

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

Changed 4 years ago by jaa-trac@…

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

Add/Change #1159 (Hard coded scheme in ticket notify emails (https vs. http))

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.