Skip to content

Instantly share code, notes, and snippets.

@franz-josef-kaiser
Last active October 11, 2015 02:10
Show Gist options
  • Select an option

  • Save franz-josef-kaiser/260bd3d19cffd4a61fa9 to your computer and use it in GitHub Desktop.

Select an option

Save franz-josef-kaiser/260bd3d19cffd4a61fa9 to your computer and use it in GitHub Desktop.
WordPress HTTP API cURL SSL Fix for Poodle and Friends
<?php
/**
* Plugin Name: Fix SSL Versions
* Description: Remove SSL v1-3 from cURL Requests. PHP v5.5.19+/5.6.3+ only
* Author: Franz Josef Kaiser <[email protected]>
* Author URl: http://unserkaiser.com
* License: MIT
*/
/**
* Security Upgrade
* Remove SSL v1-3 from from cURL Requests.
* PHP v5.5.19+/5.6.3+ only
* @param $ch
*/
add_action( 'http_api_curl', function( $ch )
{
if ( ! $ch )
return;
if (
! defined( 'CURL_SSLVERSION_TLSv1_0')
|| ! defined( 'CURL_SSLVERSION_TLSv1_1')
|| ! defined( 'CURL_SSLVERSION_TLSv1_2')
)
return;
curl_setopt(
$ch,
CURLOPT_SSLVERSION,
CURL_SSLVERSION_TLSv1_2
| CURL_SSLVERSION_TLSv1_1
| CURL_SSLVERSION_TLSv1_0
);
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment