1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/net/ftp.rb: Add :nodoc: for private methods.

[Ruby 1.9 - Bug #4710]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-05-25 00:26:51 +00:00
parent 9af99106c1
commit 9c711c0be6
2 changed files with 44 additions and 34 deletions

View file

@ -1,3 +1,8 @@
Wed May 25 09:26:29 2011 Eric Hodel <drbrain@segment7.net>
* lib/net/ftp.rb: Add :nodoc: for private methods.
[Ruby 1.9 - Bug #4710]
Wed May 25 09:19:17 2011 Eric Hodel <drbrain@segment7.net> Wed May 25 09:19:17 2011 Eric Hodel <drbrain@segment7.net>
* ext/zlib/zlib.c: Fix Document-method declarations. Improve * ext/zlib/zlib.c: Fix Document-method declarations. Improve

View file

@ -152,10 +152,12 @@ module Net
end end
end end
# Sends a command to destination host, with the current binary sendmode type. # Sends a command to destination host, with the current binary sendmode
# If binary mode is +true+, then send "TYPE I" (image) # type.
# else send "TYPE A" (ascii). #
def send_type_command # If binary mode is +true+, then "TYPE I" (image) is sent, otherwise "TYPE
# A" (ascii) is sent.
def send_type_command # :nodoc:
if @binary if @binary
voidcmd("TYPE I") voidcmd("TYPE I")
else else
@ -169,7 +171,7 @@ module Net
# transaction with binary sendmode of +newmode+. # transaction with binary sendmode of +newmode+.
# #
# +newmode+ is either +true+ or +false+ # +newmode+ is either +true+ or +false+
def with_binary(newmode) def with_binary(newmode) # :nodoc:
oldmode = binary oldmode = binary
self.binary = newmode self.binary = newmode
begin begin
@ -181,21 +183,22 @@ module Net
private :with_binary private :with_binary
# Obsolete # Obsolete
def return_code def return_code # :nodoc:
$stderr.puts("warning: Net::FTP#return_code is obsolete and do nothing") $stderr.puts("warning: Net::FTP#return_code is obsolete and do nothing")
return "\n" return "\n"
end end
# Obsolete # Obsolete
def return_code=(s) def return_code=(s) # :nodoc:
$stderr.puts("warning: Net::FTP#return_code= is obsolete and do nothing") $stderr.puts("warning: Net::FTP#return_code= is obsolete and do nothing")
end end
# Contructs a socket with +host+ and +port+. # Contructs a socket with +host+ and +port+.
# If SOCKSSocket is defined and the environment (ENV) #
# defines SOCKS_SERVER, then a SOCKSSocket is returned, # If SOCKSSocket is defined and the environment (ENV) defines
# else a TCPSocket is returned. # SOCKS_SERVER, then a SOCKSSocket is returned, else a TCPSocket is
def open_socket(host, port) # returned.
def open_socket(host, port) # :nodoc:
if defined? SOCKSSocket and ENV["SOCKS_SERVER"] if defined? SOCKSSocket and ENV["SOCKS_SERVER"]
@passive = true @passive = true
return SOCKSSocket.open(host, port) return SOCKSSocket.open(host, port)
@ -233,9 +236,9 @@ module Net
end end
end end
# If string +s+ includes the PASS command (password), # If string +s+ includes the PASS command (password), then the contents of
# then the contents of the password are cleaned from the string using "*" # the password are cleaned from the string using "*"
def sanitize(s) def sanitize(s) # :nodoc:
if s =~ /^PASS /i if s =~ /^PASS /i
return s[0, 5] + "*" * (s.length - 5) return s[0, 5] + "*" * (s.length - 5)
else else
@ -244,9 +247,9 @@ module Net
end end
private :sanitize private :sanitize
# Ensures that +line+ has a control return / line feed (CRLF) # Ensures that +line+ has a control return / line feed (CRLF) and writes
# and writes it to the socket. # it to the socket.
def putline(line) def putline(line) # :nodoc:
if @debug_mode if @debug_mode
print "put: ", sanitize(line), "\n" print "put: ", sanitize(line), "\n"
end end
@ -255,9 +258,8 @@ module Net
end end
private :putline private :putline
# Reads a line from the sock. # Reads a line from the sock. If EOF, then it will raise EOFError
# If EOF, then it will raise EOFError def getline # :nodoc:
def getline
line = @sock.readline # if get EOF, raise EOFError line = @sock.readline # if get EOF, raise EOFError
line.sub!(/(\r\n|\n|\r)\z/n, "") line.sub!(/(\r\n|\n|\r)\z/n, "")
if @debug_mode if @debug_mode
@ -268,7 +270,7 @@ module Net
private :getline private :getline
# Receive a section of lines until the response code's match. # Receive a section of lines until the response code's match.
def getmultiline def getmultiline # :nodoc:
line = getline line = getline
buff = line buff = line
if line[3] == ?- if line[3] == ?-
@ -283,9 +285,10 @@ module Net
private :getmultiline private :getmultiline
# Recieves a response from the destination host. # Recieves a response from the destination host.
# Either returns the response code, FTPTempError, #
# FTPPermError, or FTPProtoError # Returns the response code or raises FTPTempError, FTPPermError, or
def getresp # FTPProtoError
def getresp # :nodoc:
@last_response = getmultiline @last_response = getmultiline
@last_response_code = @last_response[0, 3] @last_response_code = @last_response[0, 3]
case @last_response_code case @last_response_code
@ -302,8 +305,10 @@ module Net
private :getresp private :getresp
# Recieves a response. # Recieves a response.
# Raises FTPReplyError if the first position of the response code is not equal 2. #
def voidresp # Raises FTPReplyError if the first position of the response code is not
# equal 2.
def voidresp # :nodoc:
resp = getresp resp = getresp
if resp[0] != ?2 if resp[0] != ?2
raise FTPReplyError, resp raise FTPReplyError, resp
@ -332,7 +337,7 @@ module Net
end end
# Constructs and send the appropriate PORT (or EPRT) command # Constructs and send the appropriate PORT (or EPRT) command
def sendport(host, port) def sendport(host, port) # :nodoc:
af = (@sock.peeraddr)[0] af = (@sock.peeraddr)[0]
if af == "AF_INET" if af == "AF_INET"
cmd = "PORT " + (host.split(".") + port.divmod(256)).join(",") cmd = "PORT " + (host.split(".") + port.divmod(256)).join(",")
@ -348,7 +353,7 @@ module Net
# Constructs a TCPServer socket, and sends it the PORT command # Constructs a TCPServer socket, and sends it the PORT command
# #
# Returns the constructed TCPServer socket # Returns the constructed TCPServer socket
def makeport def makeport # :nodoc:
sock = TCPServer.open(@sock.addr[3], 0) sock = TCPServer.open(@sock.addr[3], 0)
port = sock.addr[1] port = sock.addr[1]
host = sock.addr[3] host = sock.addr[3]
@ -358,7 +363,7 @@ module Net
private :makeport private :makeport
# sends the appropriate command to enable a passive connection # sends the appropriate command to enable a passive connection
def makepasv def makepasv # :nodoc:
if @sock.peeraddr[0] == "AF_INET" if @sock.peeraddr[0] == "AF_INET"
host, port = parse227(sendcmd("PASV")) host, port = parse227(sendcmd("PASV"))
else else
@ -370,7 +375,7 @@ module Net
private :makepasv private :makepasv
# Constructs a connection for transferring data # Constructs a connection for transferring data
def transfercmd(cmd, rest_offset = nil) def transfercmd(cmd, rest_offset = nil) # :nodoc:
if @passive if @passive
host, port = makepasv host, port = makepasv
conn = open_socket(host, port) conn = open_socket(host, port)
@ -914,7 +919,7 @@ module Net
# (Entering Passive Mode (h1,h2,h3,h4,p1,p2)) # (Entering Passive Mode (h1,h2,h3,h4,p1,p2))
# #
# Returns host and port. # Returns host and port.
def parse227(resp) def parse227(resp) # :nodoc:
if resp[0, 3] != "227" if resp[0, 3] != "227"
raise FTPReplyError, resp raise FTPReplyError, resp
end end
@ -937,7 +942,7 @@ module Net
# (Entering Long Passive Mode) # (Entering Long Passive Mode)
# #
# Returns host and port. # Returns host and port.
def parse228(resp) def parse228(resp) # :nodoc:
if resp[0, 3] != "228" if resp[0, 3] != "228"
raise FTPReplyError, resp raise FTPReplyError, resp
end end
@ -973,7 +978,7 @@ module Net
# (Extended Passive Mode Entered) # (Extended Passive Mode Entered)
# #
# Returns host and port. # Returns host and port.
def parse229(resp) def parse229(resp) # :nodoc:
if resp[0, 3] != "229" if resp[0, 3] != "229"
raise FTPReplyError, resp raise FTPReplyError, resp
end end
@ -996,7 +1001,7 @@ module Net
# ("PATHNAME" created) # ("PATHNAME" created)
# #
# Returns host and port. # Returns host and port.
def parse257(resp) def parse257(resp) # :nodoc:
if resp[0, 3] != "257" if resp[0, 3] != "257"
raise FTPReplyError, resp raise FTPReplyError, resp
end end