Project

General

Profile

ActionsLike0

Feature #14035

closed

URI module always serializes to the minimal form insted of the traditional one

Added by ioggstream (Roberto Polli) over 7 years ago. Updated about 7 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:83423]

Description

Reproduce

execute URI("file:///etc/hosts").to_s

I expect

I wish

  • URI to preserve the minimal/traditional form.

URI("file:///etc/hosts").to_s == "file:///etc/hosts"
URI("file:/etc/hosts").to_s == "file:/etc/hosts"

Instead

  • URI("file:///etc/hosts").to_s == "file:/etc/hosts"

  • URI("file:///etc/hosts").host == nil

Proposal for Ruby 2.4

Adopting the convention of an "empty host" instead of no authority when the passed string has the traditional form.

  • file schema to have a blank/empty "" host

suggested in rfc3986 will fix the issue.

   If the URI scheme defines a default for host, then that default
   applies when the host subcomponent is undefined or when the
   registered name is empty (zero length).  For example, the "file" URI
   scheme is defined so that no authority, an empty host, and
   "localhost" all mean the end-user's machine, whereas the "http"
   scheme considers a missing authority or empty host invalid.

Related issues 1 (1 open0 closed)

Related to Ruby - Feature #15861: Correctly parse `file:c:/path/to/file` URIsOpenActions
#1

Updated by ioggstream (Roberto Polli) over 7 years ago

  • Subject changed from URI module file representation does not conform to the standard to URI module file representation uses the minimal form instead of the traditional one.
#3

Updated by ioggstream (Roberto Polli) over 7 years ago

  • Tracker changed from Bug to Feature
  • Subject changed from URI module file representation uses the minimal form instead of the traditional one. to URI module always serializes to the minimal form insted of the traditional one
  • Description updated (diff)
  • ruby -v deleted (ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux])
  • Backport deleted (2.3: UNKNOWN, 2.4: UNKNOWN)
#5

Updated by naruse (Yui NARUSE) about 7 years ago

  • Status changed from Open to Closed
#6

Updated by naruse (Yui NARUSE) over 4 years ago

  • Related to Feature #15861: Correctly parse `file:c:/path/to/file` URIs added
ActionsLike0

Also available in: Atom PDF