I'm a bit worried about how this is done.  I think it would be better to do something like:

( self.secture_get and self.protocol ) or 'http'

on line 1130  then the other references can be removed.
(And you don't need to put that in an IF statement...