[wp-trac] [WordPress Trac] #20434: cURL fails to follow redirects sometimes

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 13 08:24:36 UTC 2012


#20434: cURL fails to follow redirects sometimes
--------------------------+-----------------------------
 Reporter:  evansolomon   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  HTTP          |    Version:
 Severity:  normal        |   Keywords:  needs-patch
--------------------------+-----------------------------
 r20208 changed the way WP_HTTP (specifically cURL) handles redirects, and
 as a result broke the way it handles some redirects (both 301 and 302)
 that were previously working.  It doesn't fail on all 301/302 redirects.

 At first I thought it failed only for requests with more than 1 redirect,
 but in testing with the Quantcast top 100 lists (assuming these sites
 should have no problems loading usually) I found an exception to that rule
 in http://facebook.com, which works and has 2 redirects.  Then I thought
 it only failed for requests with more than 1 301 redirect, but I found an
 exception to that in http://dailymotion.com, which fails and only has 1
 301 redirect (and a 302).

 Here are a couple examples that fail using wp_remote_get():
 http://skype.com, http://microsoft.com, http://dailymotion.com,

 Here are a couple from the same list that work (and go through redirects):
 http://google.com, http://facebook.com, http://yahoo.com

 As of r20208 wp_remote_get() returns empty arrays and strings for headers,
 body, response, etc.  As of r20370 the same failed requests return a
 WP_Error object with an error code of 'http_request_failed' and an error
 message of ' malformed' (including the leading space).  As of r20460 the
 same WP_Error objects are still returned.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20434>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list