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

Tony Parker anthony.parker at apple.com
Thu Oct 27 11:13:08 CDT 2016


In general we want to encourage the use of “common currency” types across the SDK. Introducing new types that are almost the same as existing ones but with a subtle behavior difference has a tendency to cause forking of APIs and introduce what we like to call impedance mismatch. Callers would end up having to convert back and forth for very little reason.

Like I said, I think we can resolve this with URL itself. We just need some time to figure out the consequences on Darwin. We’re looking into it.

- Tony

> On Oct 27, 2016, at 9:09 AM, Jacob Bandes-Storch <jtbandes at gmail.com> wrote:
> 
> Another option might be to introduce a separate type, such as "URI", which uses only the new behavior.
> On Thu, Oct 27, 2016 at 9:05 AM Tony Parker <anthony.parker at apple.com <mailto:anthony.parker at apple.com>> wrote:
> For what it’s worth, we had this discussion in a PR already:
> 
> https://github.com/apple/swift-corelibs-foundation/pull/664 <https://github.com/apple/swift-corelibs-foundation/pull/664>
> 
>> The issue here is that the compatibility API in question is NSURL/URL, and we want to maintain compatibility between it and NSURLComponents/URLComponents. Therefore this code chooses to percent encode the ;.
>> 
>> If/when we change the behavior of NSURL/URL itself (which we have to do carefully, as many apps out there rely on its nuances), then we can change this one as well. This code is shared on all of our platforms so we can't forget about the consequences for darwin API as well.
>> 
>> I think the best place for this patch right now is in a JIRA, so we can track updating these together in the future.
> 
> It’s not impossible to change, but we still want to maintain cross-platform behavior so we would need to change it in Darwin as well. And to change it there, we want it to be consistent behavior between NSURL and NSURLComponents. And to change NSURL we have to be careful about the consequences of changing the behavior under all existing apps. We have first hand experience with changes in NSURL causing strange behavior in other apps.
> 
> - Tony
> 
>> On Oct 27, 2016, at 2:24 AM, Chris Bailey via swift-server-dev <swift-server-dev at swift.org <mailto:swift-server-dev at swift.org>> wrote:
>> 
>> Hi Jacob: 
>> 
>> This should really be posted to swift-corelibs-dev, which covers the Foundation library which covers URL and URLComponents - there's more people on that list that are likely to pick this up. 
>> 
>> Chris
>> 
>> 
>> 
>> 
>> From:        Jacob Bandes-Storch via swift-server-dev <swift-server-dev at swift.org <mailto:swift-server-dev at swift.org>> 
>> To:        swift-server-dev at swift.org <mailto:swift-server-dev at swift.org> 
>> Date:        27/10/2016 07:24 
>> Subject:        Re: [swift-server-dev] [Bug] Foundation.URL should support semicolon(; ) appearing in URL path 
>> Sent by:        swift-server-dev-bounces at swift.org <mailto:swift-server-dev-bounces at swift.org> 
>> 
>> 
>> 
>> Sorry for fake threading, the original message was sent before I subscribed to this list. 
>> 
>> 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. 
>> 
>> Just wanted to point out some related bugs that I have filed in the past: 
>> 
>> - https://bugs.swift.org/browse/SR-21 <https://bugs.swift.org/browse/SR-21> 
>> 
>> - rdar://23241861 <>  "NSFont fontWithDescriptor:size: fails when passed a URL with a semicolon in it" (marked as dupe of rdar://22424272 <>) 
>> 
>> 
>> Jacob_______________________________________________
>> swift-server-dev mailing list
>> swift-server-dev at swift.org <mailto:swift-server-dev at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-server-dev <https://lists.swift.org/mailman/listinfo/swift-server-dev>
>> 
>> 
>> _______________________________________________
>> swift-server-dev mailing list
>> swift-server-dev at swift.org <mailto:swift-server-dev at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-server-dev <https://lists.swift.org/mailman/listinfo/swift-server-dev>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-server-dev/attachments/20161027/e4a39a8f/attachment.html>


More information about the swift-server-dev mailing list