Hope someone can follow this...
I have an action in a controller which attempts to use
Net::HTTP.get_response() to get pages over http so it can write them to
disk.
If I do this:
response
Net::HTTP.get_response(URI.parse("http://localhost:3000/index.html"))
It fails the error shown at the bottom of this post
But if I replace localhost with the name of our staging server (which is
on a different machine) it succeeds:
response
Net::HTTP.get_response(URI.parse("http://staging:3000/index.html"))
Both http://localhost:3000/index.html and
http://stageing:3000/index.html pull up identical pages when invoked in
a browser.
Should I be able to use
Net::HTTP.get_response(URI.parse("http://localhost:3000/index.html"))
in
an action which itself is being invoked on localhost?
Incidentally if I try to run
response
Net::HTTP.get_response(URI.parse("http://staging:3000/index.html")) on
the staging server itself, I run into the same error.
----------------------------------------------------------------------
Here''s The Error
[2007-01-31 14:11:32] ERROR Errno::EINVAL: Invalid argument
c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:324:in `write''
c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:324:in
`_write_data''
c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:296:in
`send_body_string''
c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:187:in `send_body''
c:/ruby/lib/ruby/1.8/webrick/httpresponse.rb:104:in
`send_response''
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:79:in `run''
c:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread''
c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread''
c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start''
c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start''
c:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start''
c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start''
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/webrick_server.rb:67:in
`dispatch''
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/servers/webrick.rb:59
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require''
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/commands/server.rb:30
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require''
script/server:3
------------------------------------------------------------------
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---