open-uri and ftp path

G

Guillaume Marcais

I have an IIS server serving file with FTP. . When I log in with an ftp
client as 'weblog', IIS changes automatically to the weblog directory.
That's find and dandy as far as I am concerned, that's where the files
reside. But this confuses open-uri when I try to download a file:

$ irb
irb(main):001:0> require 'open-uri'
=> true
irb(main):002:0> fd = open("ftp://weblog:p[email protected]/ex050218.log")
Net::FTPPermError: 550 /ex050218.log: The system cannot find the file
specified.

from /usr/lib/ruby/1.8/net/ftp.rb:243:in `getresp'
from /usr/lib/ruby/1.8/net/ftp.rb:264:in `sendcmd'
from /usr/lib/ruby/1.8/net/ftp.rb:262:in `synchronize'
from /usr/lib/ruby/1.8/net/ftp.rb:262:in `sendcmd'
from /usr/lib/ruby/1.8/net/ftp.rb:336:in `transfercmd'
from /usr/lib/ruby/1.8/net/ftp.rb:401:in `retrbinary'
from /usr/lib/ruby/1.8/net/ftp.rb:399:in `synchronize'
from /usr/lib/ruby/1.8/net/ftp.rb:399:in `retrbinary'
from /usr/lib/ruby/1.8/net/ftp.rb:501:in `getbinaryfile'
from /usr/lib/ruby/1.8/open-uri.rb:600:in `direct_open'
from /usr/lib/ruby/1.8/open-uri.rb:169:in `open_loop'
from /usr/lib/ruby/1.8/open-uri.rb:164:in `catch'
from /usr/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
from /usr/lib/ruby/1.8/open-uri.rb:134:in `open_uri'
from /usr/lib/ruby/1.8/open-uri.rb:424:in `open'
from /usr/lib/ruby/1.8/open-uri.rb:85:in `open'
irb(main):003:0> fd =
open("ftp://weblog:p[email protected]/weblog/ex050218.log")
=> #<File:/home/gus/tmp/open-uri6592.0>
irb(main):004:0>
URI.parse("ftp://weblog:p[email protected]/ex050218.log").path
=> "/ex050218.log"

The problem is that the path reads '/ex050218.log' instead of just
'ex050218.log'.

Downloading this file using wget and the same URI works flawlessly.

Is it a bug on open-uri implementation? A difference between common
interpretation and actual definition of a URI?

Guillaume.
 
T

Tanaka Akira

Guillaume Marcais said:
Is it a bug on open-uri implementation? A difference between common
interpretation and actual definition of a URI?

It's a bug. Thank you for the report.

It's fixed now.
 
G

Guillaume Marcais

Thank you for your quick fix.

Guillaume.

Le 19 févr. 05, à 10:56, Tanaka Akira a écrit :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top