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
[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
[email protected]/weblog/ex050218.log")
=> #<File:/home/gus/tmp/open-uri6592.0>
irb(main):004:0>
URI.parse("ftp://weblog
[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.
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
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
=> #<File:/home/gus/tmp/open-uri6592.0>
irb(main):004:0>
URI.parse("ftp://weblog
=> "/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.