summaryrefslogtreecommitdiff
path: root/lib/net/protocol.rb
diff options
context:
space:
mode:
authoraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-02-07 07:23:09 +0000
committeraamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-02-07 07:23:09 +0000
commit7e5f9d5a137848b54fe6ab33caebb2631e613bf5 (patch)
treed906e0cbca08ee472d7397e9c5ba2074902e6cec /lib/net/protocol.rb
parentbf5ea589428d3a55174c773398fe49436fbac5d4 (diff)
aamine
* lib/net/http.rb: split HTTPResponse into HTTPReadResponse module. * lib/net/protocol.rb: add Net::net_private. * lib/net/protocol.rb: Socket#reopen takes arg, open_timeout. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/protocol.rb')
-rw-r--r--lib/net/protocol.rb27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb
index 9e97bee..7eb38cf 100644
--- a/lib/net/protocol.rb
+++ b/lib/net/protocol.rb
@@ -64,6 +64,14 @@ require 'timeout'
module Net
+ module NetPrivate
+ end
+
+ def self.net_private( &block )
+ ::Net::NetPrivate.module_eval( &block )
+ end
+
+
class Protocol
Version = '1.2.0'
@@ -232,6 +240,7 @@ module Net
Session = Protocol
+ net_private {
class Response
@@ -255,6 +264,8 @@ module Net
end
+ }
+
class ProtocolError < StandardError; end
class ProtoSyntaxError < ProtocolError; end
@@ -326,8 +337,7 @@ module Net
- module NetPrivate
-
+ net_private {
class WriteAdapter
@@ -496,12 +506,14 @@ module Net
"#<#{type} open=#{!@closed}>"
end
- def reopen
+ def reopen( otime = nil )
unless closed? then
close
@buffer = ''
end
- @socket = TCPsocket.new( @addr, @port )
+ timeout( otime ) {
+ @socket = TCPsocket.new( @addr, @port )
+ }
@closed = false
end
@@ -676,7 +688,7 @@ module Net
def write_bin( src, block )
writing {
if block then
- block.call WriteAdapter.new( self, :do_write )
+ block.call ::Net::NetPrivate::WriteAdapter.new( self, :do_write )
else
src.each do |bin|
do_write bin
@@ -690,7 +702,7 @@ module Net
wsize = use_each_crlf_line {
if block then
- block.call WriteAdapter.new( self, :wpend_in )
+ block.call ::Net::NetPrivate::WriteAdapter.new( self, :wpend_in )
else
wpend_in src
end
@@ -830,8 +842,7 @@ module Net
end
-
- end # module Net::NetPrivate
+ }
def Net.quote( str )