[wp-trac] [WordPress Trac] #19337: is_ssl() fails on LiteSpeed server

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 23 09:13:52 UTC 2011


#19337: is_ssl() fails on LiteSpeed server
--------------------------+-----------------------------
 Reporter:  niklasbr      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Security      |    Version:  3.3
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 LiteSpeed has some minor differences compared to Apache even though it is
 advertised as interchangeable, on of these differences is how $_SERVER
 works. In Apache $_SERVER["https"] exists if the visitor is loading the
 page via https protocol, but in LiteSpeed $_SERVER["https"] does not
 exists, LiteSpeed uses $_SERVER['HTTP_HTTPS'].

 This means that is_ssl() returns false even if the page is visited via
 https. The patch is to extend the function to solve this case the is_ssl()
 function would look like this:



 {{{
 function is_ssl() {
         if ( isset($_SERVER['HTTPS']) ) {
                 if ( 'on' == strtolower($_SERVER['HTTPS']) )
                         return true;
                 if ( '1' == $_SERVER['HTTPS'] )
                         return true;
         } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' ==
 $_SERVER['SERVER_PORT'] ) ) {
                 return true;
         } elseif ( isset($_SERVER['HTTP_HTTPS']) && 'on' ==
 strtolower($_SERVER['HTTP_HTTPS'])) {
                 return true;
         }

         return false;
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19337>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list