Make WordPress Core

Ticket #34883: 34883.diff

File 34883.diff, 2.5 KB (added by Outlandish Josh, 9 years ago)

Adding client cert option to HTTP reqests API

  • wp-includes/class-http.php

     
    6262         *                                             compressed content is returned in the response anyway, it will
    6363         *                                             need to be separately decompressed. Default true.
    6464         *     @type bool         $sslverify           Whether to verify SSL for the request. Default true.
    65          *     @type string       sslcertificates      Absolute path to an SSL certificate .crt file.
     65         *     @type string       $sslcertificates     Absolute path to an SSL certificate .crt file.
     66         *     @type string       $clientcert          Absolute path to a client certificate in .pem format. Default null.
    6667         *                                             Default ABSPATH . WPINC . '/certificates/ca-bundle.crt'.
    6768         *     @type bool         $stream              Whether to stream to a file. If set to true and no filename was
    6869         *                                             given, it will be droped it in the WP temp dir and its name will
  • wp-includes/class-wp-http-curl.php

     
    113113
    114114                $is_local = isset($r['local']) && $r['local'];
    115115                $ssl_verify = isset($r['sslverify']) && $r['sslverify'];
     116                $ssl_client_cert = isset($r['sslclientcert']) && $r['sslclientcert'];
    116117                if ( $is_local ) {
    117118                        /** This filter is documented in wp-includes/class-wp-http-streams.php */
    118119                        $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify );
     
    137138                if ( $ssl_verify ) {
    138139                        curl_setopt( $handle, CURLOPT_CAINFO, $r['sslcertificates'] );
    139140                }
     141                if ( $ssl_client_cert ) {
     142                        curl_setopt( $handle, CURLOPT_SSLCERT, $r['sslclientcert'] );
     143                }
    140144
    141145                curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
    142146
  • wp-includes/class-wp-http-streams.php

     
    116116                                'capture_peer_cert' => $ssl_verify,
    117117                                'SNI_enabled' => true,
    118118                                'cafile' => $r['sslcertificates'],
     119                                'local_cert' => $r['sslclientcert'],
    119120                                'allow_self_signed' => ! $ssl_verify,
    120121                        )
    121122                ) );