[wp-hackers] wp_remote_request not telling me the 301'd URL

Otto otto at ottodestruct.com
Fri Mar 11 20:29:37 UTC 2011


Two things:

1. Don't use "Http" as a class name. Seriously, prefix *everything*:
http://andrewnacin.com/2010/05/11/in-wordpress-prefix-everything/

2. Why not just extend the WP_Http class instead to support what you
want it to support? Seems like you went the super-long-way-around
here.

-Otto



On Fri, Mar 11, 2011 at 2:09 PM, Edward de Leau <e at leau.net> wrote:
> I have implemented manual redirection for the wp-favicons plugin here:
> http://plugins.trac.wordpress.org/browser/wp-favicons/trunk/includes/class-http.php
>
> (part of next version 0.5.1 where a mouseover over a redirect/tiny url shows
> the url it redirects to)
> I redirect 5 times max.
>
> e.g. (1) nu.nl (301) ---> (2) www.nu.nl (200) --> (3)
> www.nu.nl/images/favicon.ico (200)
>
> I needed the manual redirection because I needed the base_href when no
> base_href is given in the HTML source.
> I then need the redirected URI to use that as base_href
>
> Code is not completely done since a use case like:
>
> e.g. (1) newscred.com (301) --> (2) http://platform.newscred.com (200) (look
> in page) --> (3) http://newscred.com/favicon.ico (301) (wtf? redirect of
> content in page) -->
> (4) http://newspapers.newscred.com/favicon.ico (200) --> (5)
> http://newspapers.newscred.com//media/img/favicon.ico (200)
>
> does not work yet since this site gives 4 as redirect url while (4) is
> actually a page. So i need to add another check for binary content in the
> beginning.
>
> But for all none favicon self-redirection this should work.
>


More information about the wp-hackers mailing list