diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-09-12 05:37:38 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-09-12 05:37:38 +0000 |
commit | fbcc6dea0c86e7e4d087f1d4b2de19b211d16647 (patch) | |
tree | 68bde87194755712893e5efa4d7f9d2f5312df10 /lib/net/http.rb | |
parent | 9d823983dc3e88cb7775c78908a4bb5133ad88ac (diff) |
matz: 1.6.0 final (hopufully)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r-- | lib/net/http.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb index e5822d6138..65cd5a9937 100644 --- a/lib/net/http.rb +++ b/lib/net/http.rb @@ -33,7 +33,7 @@ the terms of the Ruby Distribute License. : start {|http| .... } creates a new Net::HTTP object and starts HTTP session. - When this method is called as iterator, gives HTTP object to block + When this method is called with a block, gives HTTP object to block and close HTTP session after block call finished. : get( path, header = nil, dest = '' ) @@ -46,7 +46,7 @@ the terms of the Ruby Distribute License. # example response, body = http.get( '/index.html' ) - If called as iterator, give a part String of entity body. + If called with a block, give a part String of entity body. Note: If status is not 2xx(success), ProtocolError exception is @@ -81,7 +81,7 @@ the terms of the Ruby Distribute License. "header" must be a Hash like { 'Accept' => '*/*', ... }. This method returns Net::HTTPResponse object and "dest". - If called as iterator, gives a part String of entity body. + If called with a block, gives a part String of entity body. : get2( path, header = nil ) {|adapter| .... } send GET request for "path". @@ -165,7 +165,7 @@ All "key" is case-insensitive. entity body. A body is written to "dest" using "<<" method. : body {|str| ... } - get entity body by using iterator. + get entity body by using block. If this method is called twice, block is not called and returns first "dest". @@ -350,11 +350,13 @@ module Net @socket.reopen end - resp = yield( u_header ) + yield( u_header ) if ublock then adapter = HTTPReadAdapter.new( @command ) ublock.call adapter resp = adapter.off + else + resp = @command.get_response end unless keep_alive? u_header, resp then |