[wp-trac] [WordPress Trac] #16889: Having a location header does not mean that there should be a redirection.
WordPress Trac
wp-trac at lists.automattic.com
Sat May 5 01:57:55 UTC 2012
#16889: Having a location header does not mean that there should be a redirection.
--------------------+------------------------------
Reporter: hakre | Owner:
Type: defect | Status: reopened
Priority: normal | Milestone: Awaiting Review
Component: HTTP | Version: 3.1
Severity: normal | Resolution:
Keywords: |
--------------------+------------------------------
Changes (by dd32):
* status: closed => reopened
* resolution: invalid =>
* milestone: => Awaiting Review
Comment:
I'm re-opening this to look into it again, hopefully things have changed
enough, or at least changed that we can partially fix this.
In 3.4 the way Curl follows redirects has changed, it's moved from
internal in curl, to being handled in PHP by us to make it more straight
forward.
In addition, it's been pointed out that following Location headers causes
problems for 201 (Created) requests, since WP_HTTP blindly follows the
location, the result from the Created command is lost.
An example of a request which this fouls up is this the following Google
Contacts API request (note, this output is taken directly from the curl
command line binary)
{{{
> POST /m8/feeds/contacts/default/full/?access_token=......
> HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4
OpenSSL/0.9.8r zlib/1.2.5
> Host: www.google.com
> Accept: */*
> Content-Type: application/atom+xml
> Content-Length: 465
>
< HTTP/1.1 201 Created
< Content-Type: application/atom+xml; charset=UTF-8
< Expires: Sat, 05 May 2012 01:36:29 GMT
< Date: Sat, 05 May 2012 01:36:29 GMT
< Cache-Control: private, max-age=0, must-revalidate, no-transform
< Vary: Accept, X-GData-Authorization, GData-Version
< GData-Version: 1.0
< Location:
https://www.google.com/m8/feeds/contacts/user%40gmail.com/full/123/345
< Content-Location:
https://www.google.com/m8/feeds/contacts/user%40gmail.com/full/123/345
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Server: GSE
< Transfer-Encoding: chunked
<?xml version='1.0' encoding='UTF-8'?>
...
}}}
If WP_HTTP makes the request it'll follow the Location header and the
client can't retrieve the XML payload.
One can pass `'redirection' => 0` to the request and it "just works" (at
least in the case of the curl transport) so hopefully that's a sign we can
properly fix this now
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16889#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list