[Bug] Foundation.URL should support semicolon(; ) appearing in URL path


(frogcjn) #1

http://host/book;id=1/page;2/

this URL is a valid URL, but URLComponents will ruin it with %3B
http://host/book%3Bid=1/page%3B2/

Since Swift Server is coming out, this bug should be solved.


(David Waite) #2

This is expected behavior. The semicolon character is reserved in URLs, and it requires escaping if it is used.

This is not accurate:

"If data for a URI component would conflict with a reserved
   character's purpose as a delimiter, then the conflicting data must be
   percent-encoded before the URI is formed.”

HTTP URIs do not define a semantic for the use of a semicolon within a path segment, so semicolons are legal to have unescaped.

Likewise, if there was meaning to having a semicolon within a path segment for this kind of URI, you would have broken the meaning of that URI by encoding it - in the original URI it would be a separator, while in the output URI it would be part of the path segment text.

-DW

···

On Oct 25, 2016, at 12:50 PM, Saagar Jha via swift-evolution <swift-evolution@swift.org> wrote:

On Tue, Oct 25, 2016 at 12:05 Cao, Jiannan via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

http://host/book;id=1/page;2/

this URL is a valid URL, but URLComponents will ruin it with %3B
http://host/book%3Bid=1/page%3B2/

Since Swift Server is coming out, this bug should be solved.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Dave Abrahams) #3

Hi Jiannan,

At least for now, discussion of the design of core libraries belongs on
swift-corelibs-dev, rather than swift-evolution. That's where you'll
reach the people that can usefully respond.

HTH,

···

on Tue Oct 25 2016, "Cao, Jiannan via swift-evolution" <swift-evolution@swift.org> wrote:

http://host/book;id=1/page;2/

this URL is a valid URL, but URLComponents will ruin it with %3B
http://host/book%3Bid=1/page%3B2/

Since Swift Server is coming out, this bug should be solved.

--
-Dave


(Saagar Jha) #4

This is expected behavior. The semicolon character is reserved in URLs, and
it requires escaping if it is used.

···

On Tue, Oct 25, 2016 at 12:05 Cao, Jiannan via swift-evolution < swift-evolution@swift.org> wrote:

http://host/book;id=1/page;2/

this URL is a valid URL, but URLComponents will ruin it with %3B
http://host/book%3Bid=1/page%3B2/

Since Swift Server is coming out, this bug should be solved.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution