Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the sample work and update it with documentation about how net-h…
…ttp-pipeline works. Issue #1
- Loading branch information
Showing
3 changed files
with
22 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file was deleted.
Oops, something went wrong.