Project

General

Profile

Actions

Bug #9912

closed

URI#to_s with an empty host formats the string incorrectly

Added by deafbybeheading (Maciek Sakrejda) almost 10 years ago. Updated over 6 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
[ruby-core:62966]

Description

maciek@gamera:~$ ruby -e "puts URI.parse('postgres:///foo').to_s"
postgres:/foo

The string of the formatted URI should be 'postgres:///foo'.

Postgres uses empty-host URIs to indicate a Unix socket connection should be used instead of a TCP connection (which is used if you specify 'localhost' as host), so this can be very useful.

Updated by nagachika (Tomoyuki Chikanaga) almost 10 years ago

  • Status changed from Open to Assigned
  • Assignee set to naruse (Yui NARUSE)

Updated by naruse (Yui NARUSE) over 6 years ago

  • Status changed from Assigned to Closed

Fixed it at r60970.

Updated by duerst (Martin Dürst) over 6 years ago

[I wrote this directly to ruby-core because I didn't see the issue, but want to make sure it's in the right place.]

The "postgres:" URI scheme isn't even mentioned in the registry at https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml, so I'm not really sure we should deal with it in a special way.

In more general terms, creating exceptions for schemes is a bad idea, even if it may look like a good idea.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0