Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#40153 new enhancement

Filter for wp_safe_remote_get in download_url

Reported by: realloc's profile realloc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8
Component: General Keywords: has-patch
Focuses: Cc:


I had to deal with images on a server that has basic authentication active. There is no filter in download_url that would give me the chance to add the header authentication that I needed in this case.

Attachments (2)

40153.diff (703 bytes) - added by realloc 7 years ago.
40153.2.diff (2.1 KB) - added by donmhico 5 years ago.

Download all attachments as: .zip

Change History (3)

7 years ago

5 years ago

#1 @donmhico
5 years ago

  • Keywords has-patch added

I added a new patch for this issue.

Here are some key points about the new patch I attached 40153.2.diff.

  1. Added docs regarding the new filter named download_url_remote_get_args which was introduced.
  2. Unlike the first patch, I think it's best to not allow the new filter to override $args['timeout'], $args['stream'], and $args['filename'].

$args['timeout'] can be debatable. But I think it's enough that download_url() itself accepts the $timeout params.
$args['filename'] and $args['stream'] unless there's a good reason, these 2 should also be left untouched IMHO to prevent any unexpected issues to arise with how download_url() currently works.

Note: See TracTickets for help on using tickets.