Issue #13171 has been updated by Robert A. Heiler.


Guess the behaviour is then correct because it is specified.

But I still consider it unintuitive, in particular in regards to ruby.

Should .to_s ever change the representation or given input to tokens that were not part of the original input?

Because the '/' was not part of it.

http://ruby-doc.org/stdlib-2.4.0/libdoc/uri/rdoc/URI/FTP.html#method-i-to_s states:

"Returns a String representation of the URI::FTP"

Anyway, I guess it is indeed the correct behaviour even if it seems weird.

----------------------------------------
Bug #13171: URI::FTP path has a trailing slash when just hostname and scheme provided
https://bugs.ruby-lang.org/issues/13171#change-62791

* Author: Milo Price
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
As with HTTP uris, the trailing slash on a FTP uri should be optional, per RFC 1738 (ftp://ftp.funet.fi/pub/doc/rfc/rfc1738.txt). However, under the current implementation, URI::FTP#to_s always has a trailing slash when only a hostname is provided (i.e., no path):

~~~ ruby
URI.parse("http://example.com").to_s
=> "http://example.com"
URI.parse("ftp://example.com").to_s
=> "ftp://example.com/"
~~~








-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>