summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-31 13:05:54 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-31 13:05:54 +0000
commit536770bfb01d126c1db63bb444188c8235794b58 (patch)
tree581ec303473dfe0fee404ab68d829df3dd3a7b2a /lib
parent358b2f89742edbe295daa0f2abe8b6050ecd1357 (diff)
merges r24865,r24866,r24869,r24872,r24875,r24876 and r24877 from trunk into ruby_1_9_1.
-- * lib/open-uri.rb (URI::FTP#buffer_open): use the port specified in the URI. -- test ftp over http proxy. -- fix tests. -- test invalid redirect location. -- * lib/open-uri.rb (URI::FTP#buffer_open): fix the %2F handling. -- test read_timeout. -- extra commas removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@25600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/open-uri.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 2a6c544fe6..b426455e27 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -778,8 +778,9 @@ module URI
end
require 'net/ftp'
- directories = self.path.split(%r{/}, -1)
- directories.shift if directories[0] == '' # strip a field before leading slash
+ path = self.path
+ path = path.sub(%r{\A/}, '%2F') # re-encode the beginning slash because uri library decodes it.
+ directories = path.split(%r{/}, -1)
directories.each {|d|
d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") }
}
@@ -800,7 +801,8 @@ module URI
end
# The access sequence is defined by RFC 1738
- ftp = Net::FTP.open(self.host)
+ ftp = Net::FTP.new
+ ftp.connect(self.host, self.port)
ftp.passive = true if !options[:ftp_active_mode]
# todo: extract user/passwd from .netrc.
user = 'anonymous'