Last active
October 11, 2015 02:10
-
-
Save franz-josef-kaiser/260bd3d19cffd4a61fa9 to your computer and use it in GitHub Desktop.
WordPress HTTP API cURL SSL Fix for Poodle and Friends
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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