Skip to content

Commit

Permalink
Make the sample work and update it with documentation about how net-h…
Browse files Browse the repository at this point in the history
…ttp-pipeline works. Issue #1
  • Loading branch information
drbrain committed Sep 26, 2011
1 parent 7c592a3 commit b25d160
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Manifest.txt
Expand Up @@ -4,5 +4,5 @@ Manifest.txt
README.txt
Rakefile
lib/net/http/pipeline.rb
sample/two_get.rb
sample/pipeline.rb
test/test_net_http_pipeline.rb
21 changes: 21 additions & 0 deletions sample/pipeline.rb
@@ -0,0 +1,21 @@
require 'net/http/pipeline'

http = Net::HTTP.new 'localhost'
http.set_debug_output $stderr # so you can see what is happening
# http.pipelining = true # set this when localhost:80 is an HTTP/1.1 server

http.start do |http|
reqs = []
reqs << Net::HTTP::Get.new('/?a') # this request will be non-pipelined
# to check if localhost:80 is HTTP/1.1
# unless http.pipelining == true
reqs << Net::HTTP::Get.new('/?b') # these requests will be pipelined
reqs << Net::HTTP::Get.new('/?c')

http.pipeline reqs do |res|
puts res.code
puts res.body[0..60].inspect
puts
end
end

12 changes: 0 additions & 12 deletions sample/two_get.rb

This file was deleted.

0 comments on commit b25d160

Please sign in to comment.