Hi, I am using standard Ruby library openURI to capture the HTML code from other pages. The problem openURI does not work for capturing pages from the same rails application. Here is the code: class CdCreatorController < ApplicationController require ''open-uri'' def generate lines = [] file = open("http://127.0.0.1:3001/cd_creator/product/1"){ |f| f.each_line {|line| lines << line}} @obj = lines end def product @product = Product.find(params[:id]) {|f| f.each_line {|line| p line} } end end When I call method generate I get an TimeOut Error (execution expired). But this method works just fine when I''m capturing pages from Internet or local pages with different port number. Please help me. -- 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 -~----------~----~----~----~------~----~------~--~---
i believe (someone correct me if i am wrong please) the answer is that rails only handles one request at a time. what this means is that your app is waiting for the current (external) request to finish in order to handle the next (internal) request from your open() call. can i ask why you need to access your app this particular way? On 5/15/07, Tom <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > I am using standard Ruby library openURI to capture the HTML code from > other pages. The problem openURI does not work for capturing pages from > the same rails application. > > Here is the code: > > > class CdCreatorController < ApplicationController > require ''open-uri'' > > def generate > > lines = [] > > file = open("http://127.0.0.1:3001/cd_creator/product/1"){ |f| > f.each_line {|line| lines << line}} > > @obj = lines > end > > def product > @product = Product.find(params[:id]) {|f| f.each_line {|line| p > line} } > > end > end > > When I call method generate I get an TimeOut Error (execution expired). > But this method works just fine when I''m capturing pages from Internet > or local pages > with different port number. > > Please help me. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
I know it sounds crazy, but could it be a DNS issue? Can your webserver actually see itself? I ask this because I recently dealt with a similar situation (not using rails, but ASP.NET) where the webserver has some screwy DNS issues where internal calls to 127.0.0.1 or localhost weren''t routing properly. Even doing a ping to 127.0.0.1 from commandline wouldn''t work. On May 15, 5:53 am, Tom <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > I am using standard Ruby library openURI to capture the HTML code from > other pages. The problem openURI does not work for capturing pages from > the same rails application. > > Here is the code: > > class CdCreatorController < ApplicationController > require ''open-uri'' > > def generate > > lines = [] > > file = open("http://127.0.0.1:3001/cd_creator/product/1"){ |f| > f.each_line {|line| lines << line}} > > @obj = lines > end > > def product > @product = Product.find(params[:id]) {|f| f.each_line {|line| p > line} } > > end > end > > When I call method generate I get an TimeOut Error (execution expired). > But this method works just fine when I''m capturing pages from Internet > or local pages > with different port number. > > Please help me. > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---