Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#37107 closed defect (bug) (fixed)

Requests: Proxy settings aren't honoured

Reported by: johnbillion's profile johnbillion Owned by: ocean90's profile ocean90
Milestone: 4.6 Priority: highest omg bbq
Severity: blocker Version: 4.6
Component: HTTP API Keywords: has-patch
Focuses: Cc:


Requests is not honouring the WP_PROXY_HOST and WP_PROXY_PORT constants when they're defined in wp-config.php. Any HTTP API requests simply bypass the proxy.

Attachments (1)

37107.diff (794 bytes) - added by rmccue 8 years ago.
Use proxy in Requests if available

Download all attachments as: .zip

Change History (11)

#1 @johnbillion
8 years ago

If you don't have a proxy to hand to test this, then entering dummy data into those constant values should cause the HTTP API request to fail, but it doesn't.

#2 @ocean90
8 years ago

  • Priority changed from normal to highest omg bbq
  • Severity changed from normal to blocker

Looks like WP_HTTP_Proxy is used directly in WP_Http_Curl() and WP_Http_Streams() instead of WP_Http::request() ,where it belongs I suppose, so it can be passed to Requests::request().

@dd32, @rmccue: Looks like this requires some work.

8 years ago

Use proxy in Requests if available

#3 @rmccue
8 years ago

Patch added.

@johnbillion If you already have a local setup with this, can you test and verify?

#4 @rmccue
8 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#5 @johnbillion
8 years ago

  • Keywords needs-patch added; has-patch needs-testing removed

37107.diff doesn't fix the issue. Requests are still bypassing the proxy.

Inside Requests_Proxy_HTTP::curl_before_send(), $this->proxy has no value at the point where the request is made.

#6 @ocean90
8 years ago

  • Keywords has-patch added; needs-patch removed

@johnbillion Can you please test again with applied?

#7 @johnbillion
8 years ago

With 37107.diff and both applied, Requests does now honour the proxy.

#8 @rmccue
8 years ago

Upstream PR is now merged, needs an update in the bundled version.

#9 @ocean90
8 years ago

In 38053:

HTTP API: Update Requests.

Fixes an issue where you couldn't set a Requests_Proxy_HTTP object as a proxy setting.

See #37107, #33055.

#10 @ocean90
8 years ago

  • Owner set to ocean90
  • Resolution set to fixed
  • Status changed from new to closed

In 38054:

HTTP API: Pass proxy settings to Requests.

WP_HTTP_Proxy() is used directly in WP_Http_Curl() and WP_Http_Streams(). Since WP_Http::request() doesn't use them anymore we have to move the proxy handling into WP_Http::request() so the proxy data can be passed to Requests::request().

Props rmccue.
See #33055.
Fixes #37107.

Note: See TracTickets for help on using tickets.