[wp-trac] [WordPress Trac] #49385: wp_remote_get() cannot retrieve webcal URIs
WordPress Trac
noreply at wordpress.org
Fri Feb 7 18:59:21 UTC 2020
#49385: wp_remote_get() cannot retrieve webcal URIs
------------------------------------------+------------------------------
Reporter: johnjamesjacoby | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTTP API | Version:
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses:
------------------------------------------+------------------------------
Comment (by johnjamesjacoby):
If WordPress wanted to connect the HTTP API to its allowed protocols, the
code would look something like:
{{{
$scheme = parse_url( $url, PHP_URL_SCHEME );
$allowed_protocols = wp_allowed_protocols();
if ( empty( $url ) || ! in_array( $scheme,
$allowed_protocols, true ) ) {
}}}
If it simply wanted to maintain status-quo but also allow , it would look
something like:
{{{
$scheme = parse_url( $url, PHP_URL_SCHEME );
if ( empty( $url ) || empty( $scheme ) ) {
}}}
----
PHP.net [https://www.php.net/manual/en/function.parse-url.php says]:
> This function is intended specifically for the purpose of parsing URLs
and not URIs. However, to comply with PHP's backwards compatibility
requirements it makes an exception for the file:// scheme where triple
slashes (file:///...) are allowed. For any other scheme this is invalid.
So... whether WordPress considers `webcal://` a URL or a URI scheme may
also be up for discussion.
I believe for the purposes laid out here it is a URI scheme that is
intended to be allowed, making my first code change recommendation the
most accurate one I can imagine at this time.
----
I don't have a core development checkout on this computer right now to
make the patches myself, but I'll try to remember to circle back here once
I do.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49385#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list