diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-31 13:05:54 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-31 13:05:54 +0000 |
commit | d7f5015ab9d1507913b8cb60305a65cc565f93a7 (patch) | |
tree | 581ec303473dfe0fee404ab68d829df3dd3a7b2a /lib | |
parent | e1a2d18d9e28539968320bf120ac7739adfe5a6b (diff) | |
download | ruby-d7f5015ab9d1507913b8cb60305a65cc565f93a7.tar.gz ruby-d7f5015ab9d1507913b8cb60305a65cc565f93a7.tar.xz ruby-d7f5015ab9d1507913b8cb60305a65cc565f93a7.zip |
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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@25600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/open-uri.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/open-uri.rb b/lib/open-uri.rb index 2a6c544fe..b426455e2 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' |