public
Created

Reproduction process for Typhoeus max concurrency issues with zlib

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#!/usr/bin/env ruby
require 'rubygems'
require 'typhoeus'
 
hydra = Typhoeus::Hydra.new(:max_concurrency => 1)
 
hydra.disable_memoization
typh_options = {:headers => {"Accept-Encoding" => "deflate, gzip"}, :method => :get, :verbose => false}
 
r1 = Typhoeus::Request.new("http://www.yahoo.com/", typh_options)
r2 = Typhoeus::Request.new("http://www.yahoo.com/", typh_options)
r3 = Typhoeus::Request.new("http://www.yahoo.com/", typh_options)
 
hydra.queue(r1)
hydra.queue(r2)
hydra.queue(r3)
 
hydra.run
 
expected_begin_line = "<!DOCTYPE html>"
 
[r1,r2,r3].each_with_index do |r,i|
puts '-' * 80
puts "Request #{i+1}\n\n"
puts "Url: #{r.url}\n\n"
puts "Headers sent: #{r.headers.inspect}\n\n"
puts "Headers received: #{r.response.headers_hash.inspect}\n\n"
matched = r.response.body.match(/^#{expected_begin_line}/)
puts "Matches expected beginning line?: " + (matched ? "Yes" : "NO") + "\n\n"
unless matched
puts "Don't know what this response is. It starts with: #{r.response.body[0..80]}"
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.