Bontina Chen wrote:
> I'm testing the http module in console.
> BUt I got the following error.
> Anyone knows why?
>
>>> Net::HTTP.get_print 'www.google.com', 'index.html'
> SystemStackError: stack level too deep
> from C:/InstantRails/ruby/lib/ruby/1.8/net/http.rb:451:in
> `newobj'
> from C:/InstantRails/ruby/lib/ruby/1.8/net/http.rb:451:in
> `newobj'
> from C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:451:in `new'
> from C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:374:in
> `get_response'
>
> from C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:337:in
> `get_print'
> from (irb):2
>
> THX
Hi, I'm also suffering from that issue. Please help!
A copy-pasted an example of using 'http.rb'
def open_url(_url)
http = Net::HTTP.new('http://www.yandex.ru', nil, '192.168.1.32',
3128)
http.start{
case req.request_method
when "GET" then response = http.get(path, header)
when "POST" then response = http.post(path, req.body || "", header)
when "HEAD" then response = http.head(path, header)
else
raise HTTPStatus::MethodNotAllowed,
"unsupported method `#{req.request_method}'."
end
}
end
and constantly got an exception inside start. I tried several examples I
found in doc, but wo change - I always got that exception message.
---------------------------------------------------------------------
stack level too deep
RAILS_ROOT: C:/INSTAN~1/rails_apps/myapp/config/..
Application Trace | Framework Trace | Full Trace
C:/INSTAN~1/ruby/lib/ruby/1.8/net/http.rb:451:in `newobj'
C:/INSTAN~1/ruby/lib/ruby/1.8/net/http.rb:451:in `newobj'
C:/INSTAN~1/ruby/lib/ruby/1.8/net/http.rb:451:in `new'
C:/INSTAN~1/ruby/lib/ruby/1.8/net/http.rb:440:in `start'
#{RAILS_ROOT}/lib/bot.rb:25:in `open_url'
#{RAILS_ROOT}/app/controllers/urlas_controller.rb:42:in `get_content'
---------------------------------------------------------------------
--
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---