Created
September 7, 2011 17:00
-
-
Save steveyen/1201110 to your computer and use it in GitHub Desktop.
Revisions
-
Steve Yen revised this gist
Sep 7, 2011 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,6 @@ class MyHTTP < Net::HTTP end end MyHTTP.new(host, port).start do |http| for x in 0..n req = Net::HTTP::Get.new("http://#{host}:#{port}/rest/of/url") -
Steve Yen created this gist
Sep 7, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ class MyHTTP < Net::HTTP def on_connect() @socket.io.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) end end a = Time.now MyHTTP.new(host, port).start do |http| for x in 0..n req = Net::HTTP::Get.new("http://#{host}:#{port}/rest/of/url") req.add_field('Connection', 'keep-alive') http.request(req) do |res| res.read_body end end end