hi all,
i got problem with net/http inside controller. I need to respond to
action using some remote (not REST compatible) http server (actually
returning pdf file) so inside action i use:
response = Net::HTTP.new('1.2.3.4').request_get('/url')
send_data http_response.body, :filename => "test.pdf", :type =>
“application/pdf”
…with no luck I got:
Timeout::Error in InvoicesController#pdf
execution expired
RAILS_ROOT: C:/work/z
Application Trace | Framework Trace | Full Trace
c:/ruby/lib/ruby/1.8/timeout.rb:54:in rbuf_fill' c:/ruby/lib/ruby/1.8/timeout.rb:56:in
timeout’
c:/ruby/lib/ruby/1.8/timeout.rb:76:in timeout' c:/ruby/lib/ruby/1.8/net/protocol.rb:132:in
rbuf_fill’
c:/ruby/lib/ruby/1.8/net/protocol.rb:116:in readuntil' c:/ruby/lib/ruby/1.8/net/protocol.rb:126:in
readline’
c:/ruby/lib/ruby/1.8/net/http.rb:2029:in read_status_line' c:/ruby/lib/ruby/1.8/net/http.rb:2018:in
read_new’
c:/ruby/lib/ruby/1.8/net/http.rb:1059:in request' c:/ruby/lib/ruby/1.8/net/http.rb:1046:in
request’
c:/ruby/lib/ruby/1.8/net/http.rb:547:in start' c:/ruby/lib/ruby/1.8/net/http.rb:1044:in
request’
c:/ruby/lib/ruby/1.8/net/http.rb:957:in request_get' app/controllers/invoices_controller.rb:48:in
pdf’
on ethereal i trully see that there is no response to GET but what is
interesting the same net/http code inside rake task is successfuly
downloading and saving the file locally.
What could be the problem with net/http requests inside controllers? i
may only guess that in may not be thread safe or what as controllers
use net/http mechanism for own pursposes. how to solve this issue -
any ideas?
big thanks in advance
br
K