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

David Waite david at alkaline-solutions.com
Tue Oct 25 19:11:46 CDT 2016


> On Oct 25, 2016, at 12:50 PM, Saagar Jha via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 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 Tue, Oct 25, 2016 at 12:05 Cao, Jiannan via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
> http://host/book;id=1/page;2/ <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/ <http://host/book%3Bid=1/page%3B2/>
> 
> Since Swift Server is coming out, this bug should be solved.
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161025/fc2709e2/attachment.html>


More information about the swift-evolution mailing list