I'm attempting to login and follow redirects, however, the below script
doesn't seem to do it. I arrive back at the main login page. Am I doing
something obviously wrong? Am I passing bad headers or wrong cookies?
See comments below.

Also, please don't tell me to use Mechanize. I'm trying to improve the
documentation of this library.

Code ------------------
        domain = 'login.domain.com'
        script = '/login.cfm'
        params = 'email=e / mail.com&password=passw4rd'
        Net::HTTP.start(domain,80){|http|
                loginRsp = http.post2(script,params)
                loginRsp.each {|key, val| puts key + ' = ' + val}
        puts "FIRST RESPONSE===========\r"
                puts loginRsp['location'] #Seems ok => Login2.domain.com
                request = Net::HTTP::Get.new(loginRsp['location'])
                headers = {'Cookie' => loginRsp.response['set-cookie']}
                firstRsp = http.request(request,headers)
        puts "SECOND RESPONSE===========\r"
                puts firstRsp['location']  #Might be ok. =>
Login.domain.com
                request = Net::HTTP::Get.new(firstRsp['location'])
                headers = {'Cookie' => firstRsp.response['set-cookie']}
                secondRsp = http.request(request,headers)
        puts "THIRD RESPONSE===========\r"
                puts secondRsp['location']  #Not right. Should be
home.domain.com but it is simply domain.com.
                request = Net::HTTP::Get.new(secondRsp['location'])
                headers = {'Cookie' => secondRsp.response['set-cookie']}
                thirdRsp = http.request(request,headers)
                puts "=======================END\r"
        }

-- 
Posted via http://www.ruby-forum.com/.