[wp-trac] [WordPress Trac] #17251: Determine if any WP_HTTP transport can be used before making the request

WordPress Trac wp-trac at lists.automattic.com
Thu May 12 07:15:29 UTC 2011


#17251: Determine if any WP_HTTP transport can be used before making the request
--------------------------+-----------------------
 Reporter:  mdawaffe      |       Owner:  dd32
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  3.2
Component:  HTTP          |     Version:  3.2
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+-----------------------

Comment (by mdawaffe):

 This ticket was marked as a bug because with the removed-in-3.2
 {{{http_transport_get_debug}}} and {{{http_transport_post_debug}}} hooks,
 it was possible to implement the functionality which this ticket requests.

 17251.2.diff
  * Remove reference to old hooks.
  * Add {{{wp_http_supports( $capabilities = array(), $url = null )}}}.
 {{{$capabilities}}}}...
  * ... based on {{{public WP_Http::_get_first_available_transport( $args
 )}}} (@access private).

 {{{wp_http_supports()}}} accepts either enumerated capabilities or
 {{{wp_remote_request()}}} style {{{$args}}}.

 {{{
 wp_http_supports( 'ssl' );
 wp_http_supports( array( 'ssl', 'sslverify' ) );
 $url = 'https://example.com';
 $args = array(
     'headers' => $blah,
     'timeout' => 30,
 );
 wp_http_supports( $args, $url );
 }}}

 In the last form, the first argument is the more useful, but it's nice to
 be able to pass {{{$url}}} as well so the function calculates the SSLness
 of the request for you.  That means the arguments are reversed from the
 other functions in the family.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17251#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list