TCP/IP protocol and Net::HTTP

For almost all web sites, such as www.ruby-lang.org, the code

Net::HTTP.get_print ‘www.ruby-lang.org’, ‘/’

works without a problem, returning the home page.

However, ‘ad.doubleclick.net’ is an exception. The code;

Net::HTTP.get_print ‘ad.doubleclick.net’, ‘/’

times out. If you access this site in a web browser, there is no
problem getting the home page from doubleclick; it arrives almost
immediately.

By watching the ethernet traffic, it seems that doubleclick replies
from a different IP address than the address corresponding to the
domain name, but ruby keeps listening to responses from the domain
address (note this is not a 302 redirect; it is all happening at a
much lower level). Eventually, there is a timeout error from
/usr/local/lib/ruby/1.6/net/protocol.rb:449:in `initialize’. Is this
possible within the TCP/IP protocol? Is this something that has been
dealt with in a latter release (I am still using ruby 1.6.8). Is there
some workaround?

Nigel

It doesn’t time out for me (just tried). I noticed, however,
that this server is sometimes a bit slow to respond. What
is the default timeout value for Net::HTTP?

···

On Thu, 19 Jun 2003 03:24:30 +0900, Nigel Gilbert wrote:

However, ‘ad.doubleclick.net’ is an exception. The code;
Net::HTTP.get_print ‘ad.doubleclick.net’, ‘/’
times out.


ste

Nigel Gilbert n.gilbert@soc.surrey.ac.uk wrote in message news:16DC5185-A1BA-11D7-9D0F-000393B7BBA4@soc.surrey.ac.uk

For almost all web sites, such as www.ruby-lang.org, the code

Net::HTTP.get_print ‘www.ruby-lang.org’, ‘/’

works without a problem, returning the home page.

However, ‘ad.doubleclick.net’ is an exception. The code;

Net::HTTP.get_print ‘ad.doubleclick.net’, ‘/’

Works for me (Thu 19/6 11:00) - a bit slow, but gets there with the default timeout

[alexf@localhost]$ ruby -v
ruby 1.6.7 (2002-03-19) [i386-linux]

alex fenton

···

__

It consistently times out for me. The default timeout time is 60
seconds (set in net/http), and this is much longer than doubleclick
normally takes to respond (it could not serve ad banners if it normally
responded so slowly). Here is what I obtain:

irb(main):001:0> require ‘net/http’
=> true
irb(main):002:0> Net::HTTP.get_print ‘ad.doubleclick.net’, ‘/’
TimeoutError: execution expired
from /usr/local/lib/ruby/1.6/timeout.rb:37:in connect' from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in timeout’
from /usr/local/lib/ruby/1.6/net/protocol.rb:467:in connect' from /usr/local/lib/ruby/1.6/net/protocol.rb:449:in initialize’
from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in new' from /usr/local/lib/ruby/1.6/net/protocol.rb:149:in conn_socket’
from /usr/local/lib/ruby/1.6/net/http.rb:499:in do_start' from /usr/local/lib/ruby/1.6/net/protocol.rb:131:in start’
from /usr/local/lib/ruby/1.6/net/http.rb:458:in `get_print’
from (irb):2
irb(main):003:0>

Perhaps there is something weird about my set up (MacOSX 10.2.6, ruby
1.6.8), although it doesn’t manifest itself in any other way. Can
anyone else report success or failure with this?

Nigel

···

On Thursday, June 19, 2003, at 09:00 AM, stefano wrote:

On Thu, 19 Jun 2003 03:24:30 +0900, Nigel Gilbert wrote:

However, ‘ad.doubleclick.net’ is an exception. The code;
Net::HTTP.get_print ‘ad.doubleclick.net’, ‘/’
times out.

It doesn’t time out for me (just tried). I noticed, however,
that this server is sometimes a bit slow to respond. What
is the default timeout value for Net::HTTP?


ste


__
Professor Nigel Gilbert, FREng, AcSS, Pro Vice-Chancellor and Professor
of
Sociology, University of Surrey, Guildford GU2 7XH, UK. +44 (0)1483
689173