WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#37081 closed defect (bug) (fixed)

Requests: http_api_debug parameter no longer accurate

Reported by: johnbillion Owned by: rmccue
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.6
Component: HTTP API Keywords: needs-patch
Focuses: Cc:

Description

The $class parameter that's passed to the http_api_debug action is supposed to represent the name of the transport class used for the request. Since the introduction of the Requests library, this is no longer the case. The string Requests is passed instead. This means debugging tools that hook into http_api_debug can no longer determine which transport was used.

In addition, the http_api_debug action is documented in two separate places.

Change History (3)

#1 @rmccue
3 years ago

  • Owner set to rmccue
  • Status changed from new to assigned

From WordPress' perspective, the transport is Requests, which is why I set it to that. (Also avoids bad plugins assuming that they can use a class based on the transport.) Requests exposes the transport it's using via Requests::get_transport(), unless it has been overridden in the options passed in.

Right now, there's no way of getting the transport that was used for a request back out. We could save the options on the response object, but that seems like it could easily cause a memory leak.

Any ideas how best to handle this?

#2 @dd32
3 years ago

Just to voice an opinion here - I don't have an issue breaking a debug hook, nor the specific curl one (although I think that's been implemented)

#3 @johnbillion
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 38043:

HTTP API: Remove duplicate documentation for the http_api_debug hook.

Fixes #37081

Note: See TracTickets for help on using tickets.