2015-02-24 31 views
-1

我已經從對象存儲具有鏈接HTTPS,初始化「:的getaddrinfo:姓名或不知道的服務(SocketError

需要下載食譜 '開放-URI' 開放(」/家/ ADMINI /桌面/ Apache2的。 TGZ 「 」世行「)做| WRITE_FILE | 開放(」 https://region-a.geo-1.objects.hpcloudsvc.com:443/v1/68342917034742/cookbooks/marketplace/production/apache2.tar」, 「RB」)做| READ_FILE | write_file.write(read_file.read) 結束 結束

它會下載一些供應商,但對於某些提供商而言,它不會獲得下載,如下所示:

from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:762:in open' from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:762:in block in connection' from /opt/chef/embedded/lib/ruby/1.9.1/timeout .rb:54:在timeout' from /opt/chef/embedded/lib/ruby/1.9.1/timeout.rb:99:in超時'

我試過使用resolv-replace gem也沒有解決,但沒有解決任何想法的傢伙? 是否有任何內置庫方法支持https在紅寶石?或者我們只能使用寶石?

問候, INDU

回答

-1

試試這個庫https://github.com/typhoeus/typhoeus#streaming-the-response-body它是相當真棒,支持重定向(https://github.com/typhoeus/typhoeus#following-redirections),可以做並行下載等

+0

謝謝,我已經嘗試this.It下載文件,但不能能提取它時提取它顯示不支持的格式,所以在標題內容中給出什麼?這裏是我的代碼: – user3603280 2015-03-09 04:55:57

+0

謝謝,我試過這個。它下載一個文件,但不能提取它,而提取它顯示不支持的格式,所以什麼在標題內容?這裏是我的代碼: – user3603280 2015-03-09 04:55:57

+0

require'net/https' require'uri' uri = URI.parse(「https://mylink/file.tar.gz」) headers = { 'Accept-Encoding'=> 「gzip」, } http = Net :: HTTP.new(「mysite.com」,443) http.use_ssl = true if uri.scheme ==「https」#enable SSL/TLS http.start { http.get(uri.path,headers){| res | open(「/ home/admini/Desktop/file.tar.gz」,「wb」){| file | file.write(res) } } } – user3603280 2015-03-09 05:01:19

相關問題