Description

When using https, a TypeError is raised after saving changes on wiki pages with subscribers. This occurs in MoinMoin version moin--main--1.5--patch-144.

Steps to reproduce

  1. Use Apache to serve the wiki over https
  2. Setup a user that subscribes to a wiki page
  3. As another user, save a change to the subscribed page
  4. Get TypeError page (attached)

Details

The bug is caused by a non-Boolean value in variable self.is_ssl, initialized in function setIsSSL() in MoinMoin/request.py (line 276 of 1.5--patch-144). That code reads as follows:

        self.is_ssl = (env.get('SSL_PROTOCOL') or
                       env.get('SSL_PROTOCOL_VERSION') or
                       env.get('HTTPS') == 'on')

Other portions of request.py use is_ssl as an index value. When SSL_PROTOCOL takes on the value 'TLSv1', the variable is_ssl gets a string value instead of the desired value of True or 1. This causes a TypeError exception in getQualifiedURL() (line 882):

        schema = ('http', 'https')[self.is_ssl]

traceback.html

Workaround

The following patch is one way to fix the bug. It simply coerces the value to Boolean before assigning to is_ssl:

diff -Naur moin--main--1.5--patch-144/MoinMoin/request.py moin--main--1.5--patch-144-sslfix/MoinMoin/request.py
--- moin--main--1.5--patch-144/MoinMoin/request.py      2005-10-27 06:18:55.000000000 -0400
+++ moin--main--1.5--patch-144-sslfix/MoinMoin/request.py       2005-10-27 21:29:07.000000000 -0400
@@ -273,9 +273,9 @@

         @param env: dict like object containing cgi meta variables
         """
-        self.is_ssl = (env.get('SSL_PROTOCOL') or
-                       env.get('SSL_PROTOCOL_VERSION') or
-                       env.get('HTTPS') == 'on')
+        self.is_ssl = bool(env.get('SSL_PROTOCOL') or
+                           env.get('SSL_PROTOCOL_VERSION') or
+                           env.get('HTTPS') == 'on')

     def setHost(self, host=None):
         """ Set http_host

-- MichaelHenry

Discussion

Plan

Allpied patch above.


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/TypeErrorOnHttpsPageChangeEmail (last edited 2007-10-29 19:19:13 by localhost)