Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Note that responses are returned in-order

The documentation didn't clearly explain that pipelined HTTP requests
are returned in-order.  This is a slight improvement, but sample/ really
needs a full-up WEBrick example.

See also #3
  • Loading branch information...
commit 4a0ccad70dc6a3f9579d700de10cd858526683e3 1 parent c45a2aa
Eric Hodel authored
13  README.txt
@@ -17,10 +17,10 @@ The server will respond in-order.
17 17
 
18 18
   require 'net/http/pipeline'
19 19
 
20  
-  Net::HTTP.start 'localhost' do |http|
21  
-    req1 = Net::HTTP::Get.new '/'
22  
-    req2 = Net::HTTP::Get.new '/'
23  
-    req3 = Net::HTTP::Get.new '/'
  20
+  Net::HTTP.start 'example' do |http|
  21
+    req1 = Net::HTTP::Get.new '/?response_body=a'
  22
+    req2 = Net::HTTP::Get.new '/?response_body=b'
  23
+    req3 = Net::HTTP::Get.new '/?response_body=c'
24 24
 
25 25
     http.pipeline [req1, req2, req3] do |res|
26 26
       puts res.code
@@ -29,6 +29,11 @@ The server will respond in-order.
29 29
     end
30 30
   end
31 31
 
  32
+Since pipelined requests must be return in submission order the responses
  33
+will come in the same order as submission.  If http://example/ places the
  34
++response_body+ parameter in the body of the response this will print "a" then
  35
+"b" then "c".
  36
+
32 37
 == INSTALL:
33 38
 
34 39
   gem install net-http-pipeline
13  lib/net/http/pipeline.rb
@@ -16,11 +16,11 @@
16 16
 #
17 17
 #   require 'net/http/pipeline'
18 18
 #
19  
-#   Net::HTTP.start 'localhost' do |http|
  19
+#   Net::HTTP.start 'example' do |http|
20 20
 #     requests = []
21  
-#     requests << Net::HTTP::Get.new('/')
22  
-#     requests << Net::HTTP::Get.new('/')
23  
-#     requests << Net::HTTP::Get.new('/')
  21
+#     requests << Net::HTTP::Get.new('/?response_body=a')
  22
+#     requests << Net::HTTP::Get.new('/?response_body=b')
  23
+#     requests << Net::HTTP::Get.new('/?response_body=c')
24 24
 #
25 25
 #     http.pipeline requests do |res|
26 26
 #       puts res.code
@@ -28,6 +28,11 @@
28 28
 #       puts
29 29
 #     end
30 30
 #   end
  31
+#
  32
+# Since pipelined requests must be return in submission order the responses
  33
+# will come in the same order as submission.  If http://example/ places the
  34
+# +response_body+ parameter in the body of the response this will print "a"
  35
+# then "b" then "c".
31 36
 
32 37
 module Net::HTTP::Pipeline
33 38
 
2  sample/pipeline.rb
... ...
@@ -1,6 +1,6 @@
1 1
 require 'net/http/pipeline'
2 2
 
3  
-http = Net::HTTP.new 'localhost'
  3
+http = Net::HTTP.new 'example'
4 4
 http.set_debug_output $stderr # so you can see what is happening
5 5
 # http.pipelining = true # set this when localhost:80 is an HTTP/1.1 server
6 6
 

0 notes on commit 4a0ccad

Please sign in to comment.
Something went wrong with that request. Please try again.