[wp-trac] [WordPress Trac] #37843: `http_api_curl` hook no longer available for adding custom cURL options
WordPress Trac
noreply at wordpress.org
Sat Oct 1 18:25:47 UTC 2016
#37843: `http_api_curl` hook no longer available for adding custom cURL options
--------------------------+-----------------------
Reporter: ChaseWiseman | Owner: rmccue
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 4.7
Component: HTTP API | Version: 4.6
Severity: major | Resolution:
Keywords: has-patch | Focuses:
--------------------------+-----------------------
Comment (by reidbusi):
Thanks for the explanation! Makes sense. So now I can just add a regular
WP action inside a WP version conditional like so:
{{{#!php
if ( version_compare( $wp_version, "4.6", ">=" ) ) {
if ( class_exists( 'Requests' ) ) {
add_action( 'requests-curl.before_send',
'rpco_http_api_curl', PHP_INT_MAX, 1 );
}
} else {
add_action( 'http_api_curl', 'rpco_http_api_curl',
PHP_INT_MAX, 1 );
}
}}}
That makes it relatively simple. I have tested your posted patch and it is
behaving as expected and desired.
[[BR]]
> That's why the action still exists. In 99% of cases, you're best off
using the higher level abstractions for compatibility.
Thanks for keeping it, because CentOS is pretty popular with hosts and as
of version 7 CentOS still uses NSS instead of OpenSSL, and depending on
the build environment cURL may or may not be able to auto-negotiate SSL
versions and cipher suites, which are pretty critical to eCommerce
websites.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37843#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list