Nmap Development mailing list archives

http redirect problems


From: Robin Wood <robin () digininja org>
Date: Thu, 28 Feb 2013 17:38:58 +0000

I'm trying to get the redirect_ok closure working with http.get but having
problems so looking for some help.

This is the code:

    result = http.get(host, port, path, { redirect_ok = function(host,port)
            stdnse.print_debug(1, "********** REDIRECT ************")
            local c = 5
            return function(url)
                stdnse.print_debug(1, "********** " .. url.port .. "
************")
                stdnse.print_debug(1, "********** " .. url.host .. "
************")
                if ( c==0 ) then return false end
                    c = c - 1
                    return true
                end
        end
        }
    )

If I start the process with just twitter.com then it redirects to
https://twitter.com. The redirect code kicks in but then I get bounced from
http to https and back again till the counter hits 0 and the script returns
false. This is the output

NSE: ********** REDIRECT ************
NSE: ********** 443 ************
NSE: ********** twitter.com ************
NSE: ********** 80 ************
NSE: ********** twitter.com ************
NSE: ********** 443 ************
NSE: ********** twitter.com ************
NSE: ********** 80 ************
NSE: ********** twitter.com ************
NSE: ********** 443 ************
NSE: ********** twitter.com ************
NSE: ********** 80 ************
NSE: ********** twitter.com ************
NSE: ********** AFTER GET ************

I checked by hand and if I curl http://twitter.com then it shows the 301
redirect but if I then get https://twitter.com it returns a page, not
another redirect.

Have I done something wrong here?

Robin
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: