PhpHttpRequest: Drop back-compat code for PHP 5.5 and before
authorJames D. Forrester <jforrester@wikimedia.org>
Thu, 24 May 2018 20:03:18 +0000 (13:03 -0700)
committerJames D. Forrester <jforrester@wikimedia.org>
Thu, 31 May 2018 01:03:44 +0000 (18:03 -0700)
Change-Id: Ic2b144e333639dfeff0a86b14e4b4927e9bf6db0

includes/http/PhpHttpRequest.php

index 0f499c2..30ab181 100644 (file)
@@ -137,13 +137,7 @@ class PhpHttpRequest extends MWHttpRequest {
                }
 
                if ( $this->sslVerifyHost ) {
-                       // PHP 5.6.0 deprecates CN_match, in favour of peer_name which
-                       // actually checks SubjectAltName properly.
-                       if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
-                               $options['ssl']['peer_name'] = $this->parsedUrl['host'];
-                       } else {
-                               $options['ssl']['CN_match'] = $this->parsedUrl['host'];
-                       }
+                       $options['ssl']['peer_name'] = $this->parsedUrl['host'];
                }
 
                $options['ssl'] += $this->getCertOptions();
@@ -169,19 +163,6 @@ class PhpHttpRequest extends MWHttpRequest {
                        restore_error_handler();
 
                        if ( !$fh ) {
-                               // HACK for instant commons.
-                               // If we are contacting (commons|upload).wikimedia.org
-                               // try again with CN_match for en.wikipedia.org
-                               // as php does not handle SubjectAltName properly
-                               // prior to "peer_name" option in php 5.6
-                               if ( isset( $options['ssl']['CN_match'] )
-                                       && ( $options['ssl']['CN_match'] === 'commons.wikimedia.org'
-                                               || $options['ssl']['CN_match'] === 'upload.wikimedia.org' )
-                               ) {
-                                       $options['ssl']['CN_match'] = 'en.wikipedia.org';
-                                       $context = stream_context_create( $options );
-                                       continue;
-                               }
                                break;
                        }