Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curl::Multi.http behaves incorrectly when using the :max_connects option #267

Open
sriedel opened this issue Nov 12, 2015 · 0 comments
Open

Comments

@sriedel
Copy link
Contributor

sriedel commented Nov 12, 2015

It seems that it re-uses the urls from the restart of the list:

2.2.3 :001 > require 'curb'
 => true 
2.2.3 :002 > results = []
 => [] 
2.2.3 :003 > Curl::Multi.http( [ { :url => "http://www.google.de", :method => :get }, { :url => "http://www.cnn.com", :method => :get }, { :url => "http://ft.com", :method => :get } ], :max_connects => 1 ) { |*args| results << args }
 => nil 
2.2.3 :004 > results
 => [[#<Curl::Easy http://www.google.de>, nil, :get], [#<Curl::Easy http://www.google.de>, nil, :get], [#<Curl::Easy http://www.google.de>, nil, :get]] 
2.2.3 :007 > results.clear
 => [] 
2.2.3 :008 > Curl::Multi.http( [ { :url => "http://www.google.de", :method => :get }, { :url => "http://www.cnn.com", :method => :get }, { :url => "http://ft.com", :method => :get } ], :max_connects => 2  ) { |*args| results << args }
 => nil 
2.2.3 :009 > results
 => [[#<Curl::Easy http://www.google.de>, nil, :get], [#<Curl::Easy http://www.google.de>, nil, :get], [#<Curl::Easy http://ft.com>, nil, :get]] 
2.2.3 :010 > results.clear
 => [] 
2.2.3 :011 > Curl::Multi.http( [ { :url => "http://www.google.de", :method => :get }, { :url => "http://www.cnn.com", :method => :get }, { :url => "http://ft.com", :method => :get } ], :max_connects => 3  ) { |*args| results << args }
 => true 
2.2.3 :012 > results
 => [[#<Curl::Easy http://www.cnn.com>, nil, :get], [#<Curl::Easy http://www.google.de>, nil, :get], [#<Curl::Easy http://ft.com>, nil, :get]] 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant