Weird Net::HTTP error

You can copy and paste this in irb, but...this is a really strange
problem. If ssh into my server in Oregon and paste the following code in
irb it works just fine. If I ssh in one of my servers in Boston and
paste the same code in irb I get a connection refused error. Any idea
why this is happening?

Here is the code:

require 'net/http'
require 'uri'

uri =
URI.parse('http://www.ticketmaster.com/event/0A003C8C9F3F6DF3?artistid=735836&majorcatid=10001&minorcatid=60')
http = Net::HTTP::Proxy(nil).new(uri.host)
req = Net::HTTP::Get.new(uri.path)
req.add_field 'User-Agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US;
rv:1.8.0.3) Gecko/20060425 SUSE/1.5.0.3-7 Firefox/1.5.0.3'
req.add_field 'Accept',
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
req.add_field 'Accept-Language', 'en-us,en;q=0.5'
req.add_field 'Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
req.add_field 'Keep-Alive', '300'
req.add_field 'Connection', 'keep-alive'
res = http.start { |http| http.request req }

Also, the reason I added all of those headers is because ticket master
checks for them. As far as I can tell, those headers are generic and I'm
not sure why it would work on one server and not on another.

Any help is greatly appreciated.

···

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

Also, if you add

puts res.body

You will get all of the HTML for that page. Just a note that might help.

Thanks a lot.

···

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

Ben Johnson wrote:

You can copy and paste this in irb, but...this is a really strange problem. If ssh into my server in Oregon and paste the following code in irb it works just fine. If I ssh in one of my servers in Boston and paste the same code in irb I get a connection refused error. Any idea why this is happening?

*Exact* same OS and configuration on both machines? Exact same Ruby version? Firewalls? Routers? DNS stuff?

Can you shell in and connect from the CLI to the target Web site using lynx or wget?

···

--
James Britt

"Discover the recipes you are using and abandon them."
  - Brian Eno and Peter Schmidt, Oblique Strategies

Yeah, if anything it is an issue on your server as I can execute the code fine and I am in Boston.

···

On Sun, 25 Jun 2006 14:51:19 +0900 James Britt <james.britt@gmail.com> wrote:

Ben Johnson wrote:
> You can copy and paste this in irb, but...this is a really strange
> problem. If ssh into my server in Oregon and paste the following code in
> irb it works just fine. If I ssh in one of my servers in Boston and
> paste the same code in irb I get a connection refused error. Any idea
> why this is happening?

*Exact* same OS and configuration on both machines? Exact same Ruby
version? Firewalls? Routers? DNS stuff?

Can you shell in and connect from the CLI to the target Web site using
lynx or wget?

--
James Britt

"Discover the recipes you are using and abandon them."
  - Brian Eno and Peter Schmidt, Oblique Strategies

James Britt wrote:

Ben Johnson wrote:

You can copy and paste this in irb, but...this is a really strange
problem. If ssh into my server in Oregon and paste the following code in
irb it works just fine. If I ssh in one of my servers in Boston and
paste the same code in irb I get a connection refused error. Any idea
why this is happening?

*Exact* same OS and configuration on both machines? Exact same Ruby
version? Firewalls? Routers? DNS stuff?

Can you shell in and connect from the CLI to the target Web site using
lynx or wget?

--
James Britt

"Discover the recipes you are using and abandon them."
  - Brian Eno and Peter Schmidt, Oblique Strategies

curl --url www.ticketmaster.com doesn't work either. So I guess the IP
is banned from that data center, ha ha.

Thanks for your help. I guess its not a ruby issue.

···

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