summaryrefslogtreecommitdiff
path: root/lib/net/http.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-07 10:04:25 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-07 10:04:25 +0000
commita20863ff41b0493da0d16597b693e88b54731c03 (patch)
tree372d570d1bca168621914790fdb617deec97580a /lib/net/http.rb
parent4ed1344bd7a2527e54002e4ecb59833b99f30b43 (diff)
aamine
* lib/net/smtp.rb: SMTP.new requires at least one arg. * lib/net/pop.rb: POP.new requires at least one arg. * lib/net/pop.rb: uses "raise *Error.new" instead of simple raise. * lib/net/http.rb: HTTP.new requires at least one arg. * lib/net/http.rb: changes implicit start algolithm. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r--lib/net/http.rb27
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 455c3987ff..730ea8eafc 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -11,9 +11,8 @@ This program is free software. You can re-distribute and/or
modify this program under the same terms as Ruby itself,
Ruby Distribute License or GNU General Public License.
-NOTE: You can get Japanese version of this document from
-Ruby Documentation Project (RDP):
-((<URL:http://www.ruby-lang.org/~rubikitch/RDP.cgi>))
+NOTE: You can find Japanese version of this document in
+the doc/net directory of the standard ruby interpreter package.
== What is this module?
@@ -639,7 +638,14 @@ module Net
define_http_method_interface :Post, true, true
define_http_method_interface :Put, false, true
- def request( req, body = nil )
+ def request( req, body = nil, &block )
+ unless active? then
+ start {
+ req['connection'] = 'close'
+ return request(req, body, &block)
+ }
+ end
+
connecting( req ) {
req.__send__( :exec,
@socket, @curr_http_version, edit_path(req.path), body )
@@ -660,14 +666,7 @@ module Net
def connecting( req )
- unless active? then
- implicit = true
- req['connection'] ||= 'close'
- end
-
- if not @socket then
- start
- elsif @socket.closed? then
+ if @socket.closed? then
re_connect
end
if not req.body_exist? or @seems_1_0_server then
@@ -692,10 +691,6 @@ module Net
D 'Conn close'
@socket.close
end
-
- if implicit then
- finish
- end
end
def keep_alive?( req, res )