This post originated from an RSS feed registered with Ruby Buzz
by Eric Hodel.
Original Post: net-http-pipeline 1.0
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
An HTTP/1.1 pipelining implementation atop Net::HTTP. A pipelined
connection sends multiple requests to the HTTP server without waiting for
the responses. The server will respond in-order.
Example:
require 'net/http/pipeline'
Net::HTTP.start 'localhost' do |http|
req1 = Net::HTTP::Get.new '/'
req2 = Net::HTTP::Get.new '/'
req3 = Net::HTTP::Get.new '/'
http.pipeline [req1, req2, req3] do |res|
puts res.code
puts res.body[0..60].inspect
puts
end
end
1.0 / 2011-03-29
API change
Net::HTTP::Pipeline#pipeline requires an Array of Net::HTTPRequests now.
Major enhancement
If a sequence of requests contains a non-idempotent request #pipeline now
waits for a response to the previous request.
Minor enhancements
Check for HTTP/1.1 and persistent connections before attempting pipelining
Added Net::HTTP#persistent= to avoid pipelining-capability check.