[wp-trac] [WordPress Trac] #37843: `http_api_curl` hook no longer available for adding custom cURL options
WordPress Trac
noreply at wordpress.org
Fri Aug 26 17:35:10 UTC 2016
#37843: `http_api_curl` hook no longer available for adding custom cURL options
--------------------------+-----------------------------
Reporter: ChaseWiseman | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTTP API | Version: 4.6
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Now that 4.6 has implemented the new Requests library, the `http_api_curl`
hook is no longer used when building cURL requests, and I see that its
removal was mentioned and expected in #33055. That said, as far as I can
tell there is no longer an easy way to intercept before `curl_exec` is
run. There are a lot of posts and projects that suggest this old hook for
setting options like `CURLOPT_SSLVERSION` and the like, so I think it'd be
beneficial to maintain this ability.
The only way around it I've found is to skip `wp_remote_request()` and
roll your own `Requests::request()` call and pass it the
`$options['hooks']` after registering your own callback for the
`curl.before_send` hook.
Would it make sense to add a filter to `$options` before calling
`Requests::request()` so folks can register their own callbacks, similar
to this https://core.trac.wordpress.org/browser/trunk/src/wp-includes
/class-http.php#L311? Or perhaps there is another way of going about it
that I'm missing, and I'm happy to work up a patch if someone more
familiar with the library can suggest a good place for this.
Thanks!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37843>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list