SystemStackError: stack level too deep


#1

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:innewobj’
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:inget_response’

    from C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:337:in

`get_print’
from (irb):2

THX


#2

Try posting your question on refwell.com I got my answer there quite
quickly
U welcome:)

On Jan 31, 1:08 pm, Bontina C. removed_email_address@domain.invalid


#3

Bontina C. 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:innewobj’
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:inget_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:innewobj’
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:instart’
#{RAILS_ROOT}/lib/bot.rb:25:in open_url' #{RAILS_ROOT}/app/controllers/urlas_controller.rb:42:inget_content’


#4

Zhoran T. wrote:

Bontina C. 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:innewobj’
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:inget_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:innewobj’
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:instart’
#{RAILS_ROOT}/lib/bot.rb:25:in open_url' #{RAILS_ROOT}/app/controllers/urlas_controller.rb:42:inget_content’

Here is that code from ‘net/http.rb’. I suppose that recursion is in
charge, but I could not find out what is wrong:

def HTTP.start(address, port = nil, p_addr = nil, p_port = nil, p_user
= nil, p_pass = nil, &block) # :yield: +http+
new(address, port, p_addr, p_port, p_user, p_pass).start(&block)
end

class << HTTP
alias newobj new
end

Creates a new Net::HTTP object.

If +proxy_addr+ is given, creates an Net::HTTP object with proxy

support.

This method does not open the TCP connection.

def HTTP.new(address, port = nil, p_addr = nil, p_port = nil, p_user =
nil, p_pass = nil)
h = Proxy(p_addr, p_port, p_user, p_pass).newobj(address, port)
h.instance_eval {
@newimpl = ::Net::HTTP.version_1_2?
}
h
end

Creates a new Net::HTTP object for the specified +address+.

This method does not open the TCP connection.

def initialize(address, port = nil)
@address = address
@port = (port || HTTP.default_port)
@curr_http_version = HTTPVersion
@seems_1_0_server = false
@close_on_empty_response = false
@socket = nil
@started = false
@open_timeout = nil
@read_timeout = 60
@debug_output = nil
@use_ssl = false
@ssl_context = nil
end