cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: how to filter redirections

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Mon, 4 Apr 2011 17:59:01 -0400

On Mon, Apr 4, 2011 at 4:41 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Mon, 4 Apr 2011, moi wrote:
>
> I have to track some sites using curlpp. When i download, some site open
>> popup coming from ads or porno servers. I'd like to block those popup
>> telling curl to follow redirections, but either to blacklist some sites, or
>> to allow only redirection in the asked site.
>>
>
> If CURLOPT_FOLLOWLOCATION isn't good enough (unconditionally following HTTP
> redirects to the protocols you allow) you can _easily_ do the redirect
> following yourself using curl_easy_getinfo and CURLINFO_REDIRECT_URL and
> then you can black/whitelist the URLs all you like or whatever you decide is
> right!

You may also want to examine the page for:

1) meta refresh tags that redirect to a different url.
2) script fragments that use top.location=<newurl>
3) script fragments that use window.open(<some url>) to do popups
4) I think window.href(<new url>) works similarly to top.location
5) and then there's the <body onload=submit(something)> that can auto-submit
a form, thereby pushing you to a new url.
6) script fragments that do a submit(), as in #5

Did I miss any?

Yes, I *have* seen all of the above. Mostly separately, but on one occasion
most of the above 6 redirect forms happened one after another from the same
web server - that wasn't pretty... :)

Ralph Mitchell

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-04