I am still don’t know how to follow redirect to new dynamic
web host on
the same real host. Is it possible with Net::HTTP?
Can you tell us the actual site you are testing?
With my module http-access2 (see RAA),
ruby -rhttp-access2
-e ‘p HTTPClient.new.getContent(“http://…”)’
should follow redirect(s). But the script you posted
with Net::HTTP should work as well I think.
I am still don’t know how to follow redirect to new dynamic
web host on
the same real host. Is it possible with Net::HTTP?
Can you tell us the actual site you are testing?
With my module http-access2 (see RAA),
ruby -rhttp-access2
-e ‘p HTTPClient.new.getContent(“http://…”)’
should follow redirect(s). But the script you posted
with Net::HTTP should work as well I think.
ok, i’ll take a look at http-access2. try my script bellow - it fails
with message:
getaddrinfo: No address associated with hostname
fetch.rb:
#!/usr/local/bin/ruby -w
require ‘net/http’
require ‘uri’
uri = ‘http://www.sms.de/’
response = Net::HTTP.get_response( URI.parse( uri ) )
while Net::HTTPRedirection === response
puts response[‘Location’]
response = Net::HTTP.get_response( URI.parse( response[‘Location’] ) )
end
p response
I am still don’t know how to follow redirect to new dynamic
web host on
the same real host. Is it possible with Net::HTTP?
Can you tell us the actual site you are testing?
With my module http-access2 (see RAA),
ruby -rhttp-access2
-e ‘p HTTPClient.new.getContent(“http://…”)’
should follow redirect(s). But the script you posted
with Net::HTTP should work as well I think.
Hmm, your sample fails on http://www.sms.de/, I don’t know why.
http://www-18fea2c6be4fbed8d7597f5a7fcbd530.id.sms.de:80/
/usr/local/lib/ruby/1.8/net/protocol.rb:399:in initialize': getaddrinfo: No address associated with hostname (SocketError) from /usr/local/lib/ruby/1.8/net/protocol.rb:399:in new’
from /usr/local/lib/ruby/1.8/net/protocol.rb:399:in connect' from /usr/local/lib/ruby/1.8/net/protocol.rb:398:in timeout’
from /usr/local/lib/ruby/1.8/net/protocol.rb:398:in connect' from /usr/local/lib/ruby/1.8/net/protocol.rb:380:in initialize’
from /usr/local/lib/ruby/1.8/net/protocol.rb:151:in open' from /usr/local/lib/ruby/1.8/net/protocol.rb:151:in conn_socket’
from /usr/local/lib/ruby/1.8/net/http.rb:675:in do_start' from /usr/local/lib/ruby/1.8/net/protocol.rb:131:in start’
from /usr/local/lib/ruby/1.8/net/http.rb:635:in get_by_uri' from /usr/local/lib/ruby/1.8/net/http.rb:621:in get_response’
from ./fetch.rb:10
How was compiled ruby ? which OS ? #uname -mrs
FreeBSD 4.7-STABLE i386 #cat compile.sh
#!/bin/sh
env CFLAGS=‘-O -pipe’ ./configure --enable-shared
Now www.sms.de use a cookie, and probably you need to propagate this
cookie.
This was just an example of not working code, I’ll resend cookies when I
get this code to work.
pigeon% host www-18fea2c6be4fbed8d7597f5a7fcbd530.id.sms.de
www-18fea2c6be4fbed8d7597f5a7fcbd530.id.sms.de CNAME www06.sms.de
!!! www-18fea2c6be4fbed8d7597f5a7fcbd530.id.sms.de CNAME record has zero ttl www06.sms.de CNAME chief06.farm01.netzquadrat.de
chief06.farm01.netzquadrat.de A 217.10.65.97
pigeon%
Well, I really don’t know if it’s IPv6 enabled try to compile ruby with
–enable-ipv6 --with-lookup-order-hack=INET
IPv6 networking is disabled in kernel on our server. And I don’t realy
understand how all this stuff works, but I can say that this script
works well if I use proxy instead of direct connection.