[wp-trac] [WordPress Trac] #10624: Upon redirection limit being hit return redirected URL in wp_error data fields

WordPress Trac wp-trac at lists.automattic.com
Sun Aug 16 08:59:22 UTC 2009


#10624: Upon redirection limit being hit return redirected URL in wp_error data
fields
--------------------------+-------------------------------------------------
 Reporter:  dd32          |       Owner:  dd32        
     Type:  defect (bug)  |      Status:  new         
 Priority:  normal        |   Milestone:  2.9         
Component:  HTTP          |     Version:  2.9         
 Severity:  normal        |    Keywords:  dev-feedback
--------------------------+-------------------------------------------------
 Currently if you request a URL that attempts to redirect past your
 redirection limit, you'll get a object similar to this:

 {{{
 object(WP_Error)#106 (2) {
   ["errors"]=>
   array(1) {
     ["http_request_failed"]=>
     array(1) {
       [0]=>
       string(30) "Maximum (0) redirects followed"
     }
   }
   ["error_data"]=>
   array(0) {
   }
 }
 }}}

 The major problem with this is that its impossible to retrieve the
 location its being  redirected to.

 Right now, I'm using wp_remote_head() to check if its redirecting to a
 different location, Unfortunately thats not possible...

 I'll add a patch which adds the location header to the error data objects

 But i'm also tempted to suggest, that if its a HEAD request (Or really,
 any request) and redirects are set to 0, then it shouldnt attempt to
 redirect at all, and simply return the headers as is (ie. as a 301 with a
 location header and possibly empty body)

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


More information about the wp-trac mailing list