Project

General

Profile

This project is closed and read-only.

Actions

Bug #3457

closed

URI.encode does not escape square brackets

Bug #3457: URI.encode does not escape square brackets

Added by schmidt (Gregor Schmidt) over 16 years ago. Updated over 15 years ago.

Status:
Rejected
Assignee:
-

Description

=begin
According to RFC 3986 URIs may only contain square brackets to enclose IPv6 addresses within the host part of the URI. In other parts of the uri the are not allowed and need to be escaped.

A host identified by an Internet Protocol literal address, version 6
[RFC3513] or later, is distinguished by enclosing the IP literal
within square brackets ("[" and "]"). This is the only place where
square bracket characters are allowed in the URI syntax.

Square brackets are now specified as reserved within the
authority component and are not allowed outside their use as
delimiters for an IP literal within host.

The attached test case should test the desired behavior. I've tested it on 1.8.7 but I a would guess, that it is failing for all major ruby versions and interpreters.

I'm not sure, how this should be implemented while keeping the API of URI.escape in tact. The escaping needs to use two groups of safe characters, one for the host part and one for the rest. This would result in 2 optional parameters for URI.escape to provide custom safe characters for each part.
=end


Files

uri_test.rb (249 Bytes) uri_test.rb test case schmidt (Gregor Schmidt), 06/20/2010 07:01 PM

Related issues 1 (0 open — 1 closed)

Has duplicate Backport187 - Misc #3692: URI should escape or parse [ and ]RejectedActions
Actions

Also available in: PDF Atom