summaryrefslogtreecommitdiff
path: root/lib/net/http.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-12 06:04:40 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-12 06:04:40 +0000
commitbeffb7f8357091b17d5783d6f1b921c4d8727250 (patch)
tree62ab3effac982be552d42e7da2709d7356d91e9d /lib/net/http.rb
parent960676a2de16f046be01f0ef54ec4efe93ce612d (diff)
aamine
* lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.26. * lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: add module Net::NetPrivate and its inner classes {Read,Write}Adapter, Command, Socket, SMTPCommand, POP3Command, APOPCommand, HTTPCommand git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r--lib/net/http.rb96
1 files changed, 50 insertions, 46 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 5e66f9d..5a5917b 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1,6 +1,6 @@
=begin
-= net/http.rb
+= net/http.rb version 1.1.27
maintained by Minero Aoki <aamine@dp.u-netsurf.ne.jp>
This file is derived from "http-access.rb".
@@ -25,8 +25,6 @@ You can freely distribute/modify this library.
: port
HTTP default port, 80
-: command_type
- Command class for Net::HTTP, HTTPCommand
== Methods
@@ -116,9 +114,9 @@ You can freely distribute/modify this library.
ex.
- http.post2( '/index.html', 'data data data...' ) do |f|
- f.header
- f.body
+ http.post2( '/index.html', 'data data data...' ) do |adapter|
+ adapter.header
+ adapter.body
end
@@ -214,13 +212,13 @@ module Net
class HTTP < Protocol
protocol_param :port, '80'
- protocol_param :command_type, '::Net::HTTPCommand'
+ protocol_param :command_type, '::Net::NetPrivate::HTTPCommand'
class << self
def procdest( dest, block )
if block then
- return ReadAdapter.new( block ), nil
+ return NetPrivate::ReadAdapter.new( block ), nil
else
dest ||= ''
return dest, dest
@@ -420,43 +418,6 @@ module Net
HTTPSession = HTTP
- class HTTPReadAdapter
-
- def initialize( command )
- @command = command
- @header = @body = nil
- end
-
- def inspect
- "#<#{type}>"
- end
-
- def header
- unless @header then
- @header = @command.get_response
- end
- @header
- end
- alias response header
-
- def body( dest = nil, &block )
- dest, ret = HTTP.procdest( dest, block )
- unless @body then
- @body = @command.get_body( response, dest )
- end
- @body
- end
- alias entity body
-
- def off
- body
- @command = nil
- @header
- end
-
- end
-
-
class HTTPResponse < Response
def initialize( code_type, bexist, code, msg )
@@ -470,7 +431,7 @@ module Net
attr_accessor :body
def inspect
- "#<Net::HTTPResponse #{code}>"
+ "#<#{type.name} #{code}>"
end
def []( key )
@@ -559,6 +520,47 @@ module Net
HTTPVersionNotSupported = HTTPFatalErrorCode.mkchild
+ class HTTPReadAdapter
+
+ def initialize( command )
+ @command = command
+ @header = @body = nil
+ end
+
+ def inspect
+ "#<#{type}>"
+ end
+
+ def header
+ unless @header then
+ @header = @command.get_response
+ end
+ @header
+ end
+ alias response header
+
+ def body( dest = nil, &block )
+ dest, ret = HTTP.procdest( dest, block )
+ unless @body then
+ @body = @command.get_body( response, dest )
+ end
+ @body
+ end
+ alias entity body
+
+ def off
+ body
+ @command = nil
+ @header
+ end
+
+ end
+
+
+
+ module NetPrivate
+
+
class HTTPCommand < Command
HTTPVersion = '1.1'
@@ -819,4 +821,6 @@ module Net
end
+ end # module Net::NetPrivate
+
end # module Net