Opened 11 years ago
Closed 10 years ago
#28001 closed defect (bug) (fixed)
WP_Http still fails on some requests with relative url redirects
Reported by: | DrLightman | Owned by: | dd32 |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | 3.9 |
Component: | HTTP API | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
This is a follow-up to #20434.
WP_Http still fails (A valid URL was not provided.) with some urls with relative url redirects.
I was scraping web.archive.org with a plugin.
The combination of the relative redirects plus this kind of url:
http://web.archive.org/web/20131001160642/http://www.spiegel.de/thema/deutschland_nach_der_bundestagswahl/
is the culprit.
I think the problem is the check on the scheme in ::make_absolute_url where it does:
// Check for a scheme if ( false !== strpos( $maybe_relative_path, '://' ) ) return $maybe_relative_path;
so that a relative url like /web/20131001160642/http://www.spiegel.de/thema/deutschland_nach_der_bundestagswahl/
it's evaluated as absolute.
Change History (11)
#1
@
11 years ago
- Summary changed from WP_Http still fails on some requests with relative urls to WP_Http still fails on some requests with relative url redirects
#5
@
10 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
The test doesn't pass in php 5.2
https://travis-ci.org/aaronjorbin/develop.wordpress/jobs/37362400
#8
@
10 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
This method should also be used in the helpers in wp-includes/http.php
such as wp_http_validate_url()
. This probably makes the function better exposed as wp_parse_url()
to work around all the different PHP parse_url oddities.
#9
@
10 years ago
- Keywords dev-feedback added
@dd32: From your comment:8 seems like there are some leftover cases you wanted to handle here. Were you wanting to still do that in 4.1 or punt for anything left?
In 29850: