From: "knu (Akinori MUSHA)" Date: 2012-11-10T19:35:09+09:00 Subject: [ruby-core:49193] [ruby-trunk - Bug #7310] URI::FTP API inconsistency Issue #7310 has been updated by knu (Akinori MUSHA). duerst (Martin D��rst) wrote: > Most probably not! What's much more important is that the "U" in URI stands for "uniform". URI schemes have a lot of common syntax. http: and ftp: are a good example. For the common syntax, RFC 1738 is almost useless. This is very much improved in RFC 2396 and later RFC 3986. So using RFC 1738 for URI syntax is not really appropriate. Good point. > Also, please have a look at http://tantek.com/2011/238/b1/many-ways-slice-url-name-pieces. There are many differences between the various libraries, but one of the positive conclusions was the following: > "path has been used consistently for the past 10+ years and in a way consistent with its operating system roots." There's a good reason for this: Having a slash at the start means that the path is absolute. No slash means relative. Having a slash at the start is syntactically mandatory because there exists no separator defined between the authority part and the path part. The FTP scheme is an example of how it is used being different from how it looks. > Now imagine Ruby being listed at http://tantek.com/2011/238/b1/many-ways-slice-url-name-pieces, and needing two rows, because http: and ftp: are treated differently. It would look really, really bad. So please fix this as early as possible! I'd recommend using Addressable::URI for those who value proactive standard conformance as well as fancy features. It implements a #path method that always returns the part part with a leading slash. > So the only problem with changing this may be backwards compatibility, but I think this can be covered by a warning. This only problem is the most important. As I explained, the feature has been there for a long time and the behavior can be considered reasonable from a usability standpoint. I agree that there could be some other method like URI::FTP#local_path and #path could return the full path part regardless of the scheme, but how would you make that happen while taking good care of compatibility? ---------------------------------------- Bug #7310: URI::FTP API inconsistency https://bugs.ruby-lang.org/issues/7310#change-32743 Author: t3hk0d3 (Igor Yamolov) Status: Rejected Priority: Low Assignee: Category: lib Target version: next minor ruby -v: 1.9.3p194 1.9.3p194 :012 > test = URI.parse("http://test/") => # 1.9.3p194 :013 > test.path => "/" 1.9.3p194 :014 > test = URI.parse("ftp://test/") => # 1.9.3p194 :015 > test.path => "" -- http://bugs.ruby-lang.org/