Project

General

Profile

Actions

Bug #6057

closed

URI - Nonsensical Behavior

Added by sgonyea (Scott Gonyea) over 12 years ago. Updated almost 6 years ago.

Status:
Closed
Target version:
-
ruby -v:
1.9.3-p125
[ruby-core:42789]

Description

The behavior of Ruby's URI is confusing, to say the least.

URI("http://foo.com/bar") + "baz"
# => #<URI::HTTP:0x710713de URL:http://foo.com/baz> 

URI.join("http://foo.com/baz", "bar")
# => #<URI::HTTP:0x29fd5dc4 URL:http://foo.com/bar>

I could at least understand this behavior being the case if we were adding "/bar" (although it'd still be non-intuitive). That URI throws away its current path makes it a tedious library. Net::HTTP expects it as an input, yet as you interact with URI, you are constantly massaging it into and out of string form.

In my opinion, URI should model the behavior of Pathname.


Files

smime.p7s (6.22 KB) smime.p7s Anonymous, 02/22/2012 08:59 PM

Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #15276: URI.join behaviour is unintuitiveClosedActions
Has duplicate Ruby master - Bug #10075: URI#join needs documentation of its behaviorClosedzzak (zzak _)07/19/2014Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0