[wp-trac] [WordPress Trac] #37820: wp_remote_get referrer not being sent correctly
WordPress Trac
noreply at wordpress.org
Wed Aug 14 09:14:52 UTC 2019
#37820: wp_remote_get referrer not being sent correctly
--------------------------+--------------------------------
Reporter: schrapel | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: HTTP API | Version: 4.6
Severity: normal | Resolution: reported-upstream
Keywords: has-patch | Focuses:
--------------------------+--------------------------------
Comment (by nico23):
I am confused about this. I have not digged though the source but looking
at the patch it seems the URL is hard-coded in. However, if I got this
right, people say we can set the referer with in the $args['headers'] the
screenshot above shows code like this and the codex says the arrays should
contains a array with header lines. However I have seen a lot of code that
uses key-value pairs in the array so my questions are.
1. Can I set the referer with the $args on wp_remote_get/post.
2. If yes, do both of this ways work?
3. Any easy way to test this?
{{{#!php
<?php
$referer = site_url();
$wp_remote_get_args = array(
'headers' => array( "Referer: $referer\r\n" );
);
}}}
{{{#!php
<?php
$wp_remote_get_args = array(
'headers' => array( 'Referer' => site_url() )
);
$response = wp_remote_get( $api_url, $wp_remote_get_args );
}}}
And yeah seems @rmccue does not really care to fix this upstream and seems
people not really need this, that Github issue is not really getting much
attention.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37820#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list