整个错误如下
读一个url要生成一个静态文件,控制器里写个方法调用下面的方法把url内容拿到 存文件。
问题:
如果传进来的url地址是本服务器(就是当前服务器)的url,会出现《您的主机中的软件放弃了一个已建立》的错误。
如果是别的url例如 http://www.baidu.com 就会没有问题
在一个控制器正在调用一个action的时候,不能open本服务器的url
难道是rails的bug么?
Wed Jan 30 15:16:57 +0800 2008: Read error: #<Errno::ECONNABORTED: 您的主机中的软件放弃了一个已建立
的连接。>
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/http_response.rb:137:in `write'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/http_response.rb:137:in `write'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/http_response.rb:95:in `send_he
ader'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/http_response.rb:146:in `finish
ed'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:165:in `process_client'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:in `run'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:in `initialize'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:in `new'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:285:in `run'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:268:in `initialize'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:268:in `new'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel.rb:268:in `run'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/configurator.rb:282:in `run'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/configurator.rb:281:in `each'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/configurator.rb:281:in `run'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/bin/mongrel_rails:128:in `run'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/lib/mongrel/command.rb:212:in `run'
d:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.3-x86-mswin32/bin/mongrel_rails:281
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_co
nstants_in'
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'
d:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64
d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `requir
e'
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_co
nstants_in'
d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `requir
e'
d:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
读一个url要生成一个静态文件,控制器里写个方法调用下面的方法把url内容拿到 存文件。
def get_url_content url
#o = open("http://www.baidu.com")
o = open(url)
c = o.read(o.size)
o.close
c
end
问题:
如果传进来的url地址是本服务器(就是当前服务器)的url,会出现《您的主机中的软件放弃了一个已建立》的错误。
如果是别的url例如 http://www.baidu.com 就会没有问题
在一个控制器正在调用一个action的时候,不能open本服务器的url
难道是rails的bug么?