Make WordPress Core

Opened 8 years ago

Closed 3 weeks ago

Last modified 3 weeks ago

#37708 closed defect (bug) (fixed)

`wp_http_supports()` doesn't reflect what Requests can do

Reported by: dd32's profile dd32 Owned by: peterwilsoncc's profile peterwilsoncc
Milestone: 6.7 Priority: normal
Severity: normal Version: 4.6
Component: HTTP API Keywords: has-patch
Focuses: Cc:

Description

While reviewing what parts of WP_HTTP can be removed in #37705, I noticed that wp_http_supports() still performs it's checks against the WP_HTTP transports rather than querying against Requests to see if the request can be performed or not.

The only capability which we supported was ssl.

Three options:

  1. Query SSL ability against Requests (if it supports that)
  2. Deprecate and always return true;
  3. Implement a small check to see if SSL requests will be able to proceed, checking for cURL features or openssl being available (and all the other streams requirements being satisfied).

The above options are in my order of preferences, we should support it if possible, but I'm not afraid of just no-oping the function.

Marking for 4.7, with the potential for 4.6.x backporting.

Change History (22)

#1 @jorbin
8 years ago

I like the first option, though a quick look through Requests makes me think it doesn't have that functionality. @rmccue - Does that sound correct?

#2 @dd32
8 years ago

I couldn't see anything in Requests that we could use, but I also feel that adding a method for checking to see if we can *maybe* support SSL wouldn't be out of the question..

This ticket was mentioned in Slack in #core by desrosj. View the logs.


8 years ago

#4 @desrosj
8 years ago

@rmccue do you have any suggestions here?

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


8 years ago

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


8 years ago

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


8 years ago

This ticket was mentioned in Slack in #core by helen. View the logs.


8 years ago

#10 @dd32
8 years ago

  • Keywords early added
  • Milestone changed from 4.7 to Future Release

Punting, it was broken in 4.6, mostly works still as long as the majority of the WP_HTTP logic remains in sync with Requests (which it is at present).

#11 @desrosj
5 years ago

  • Keywords needs-patch removed
  • Milestone Future Release deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

I’m going to close this out as reported upstream. When Requests is updated and the PR above is merged, this will make its way in.

#12 @jrf
3 years ago

  • Milestone set to 6.0
  • Resolution reported-upstream deleted
  • Status changed from closed to reopened

Requests 2.0.0 has been released and includes the change needed to address this.

The update to Requests 2.0.0 is expected to still go into WP 5.9. Once the upgrade patch has been merged, we should be able to address this ticket with relative ease.

Related: #54504

#13 @johnbillion
3 years ago

  • Keywords early removed

This ticket was mentioned in Slack in #core by chaion07. View the logs.


2 years ago

#15 @peterwilsoncc
2 years ago

Per discussion in a recent bug scrub, I am moving this off the 6.0 milestone as it depends on Requests 2.0.0 being merged.

Props @costdev, @chaion07.

This ticket was mentioned in Slack in #core by costdev. View the logs.


2 years ago

#17 @costdev
2 years ago

  • Milestone changed from 6.0 to Future Release

This ticket was mentioned in PR #6771 on WordPress/wordpress-develop by @dd32.


3 months ago
#18

  • Keywords has-patch added

This ceases using the Deprecated WP_HTTP::_get_first_available_transport() method and calls Requests directly.

Trac ticket: https://core.trac.wordpress.org/ticket/37708

#19 @dd32
3 months ago

8 years later, this is causing some issues with WordPress playground, which uses a custom fetch transport.

https://github.com/WordPress/wordpress-playground/issues/1494

After doing some digging with the aid of wpdirectory.net I've been unable to find any instances of wp_http_supports() usage which looking for a capability other than ssl, which is good, because we (WP_HTTP & Requests) don't support anything else here :)

The only instance I could find that was not looking for SSL was code similar to this:

if ( wp_http_supports( array(), 'http://www.example.com/' ) ) { ... }

The attached PR implements option 1 from the ticket, using the Requests v2 method.

#20 @peterwilsoncc
6 weeks ago

  • Milestone changed from Future Release to 6.7

Moving this on to the 6.7 milestone for consideration.

I've approved the linked pull request. @jrf, if you have bandwidth it would be great if you could take a quick look at it too.

#21 @peterwilsoncc
3 weeks ago

  • Owner set to peterwilsoncc
  • Resolution set to fixed
  • Status changed from reopened to closed

In 58934:

HTTP API: Update wp_http_supports() to use Requests.

Update the capabilities check in wp_http_supports to use WpOrg\Requests\Requests::has_capabilities rather than the deprecated WP_HTTP::_get_first_available_transport().

Props dd32, mukesh27, costdev, desrosj, johnbillion, jorbin, jrf, chaion07.
Fixes #37708.

Note: See TracTickets for help on using tickets.