Bug 15774

Summary: REGRESSION: Redirect to mailto: protocol broken in Leopard
Product: WebKit Reporter: Jonas Walldén <jonasw>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Severity: Major CC: mrowe
Priority: P2 Keywords: InRadar, Regression
Version: 523.x (Safari 3)   
Hardware: Macintosh   
OS: OS X 10.5   
URL: http://bdash.net.nz/files/redirect-to-mailto.php

Description Jonas Walldén 2007-10-31 02:36:20 PDT
Starting in Safari 3 on 10.5 I can no longer get redirects to work when redirecting to non-http(s) protocols. For example, returning a 302 with

  Location: mailto:foo@bar.com

just gives a confusing error message in the browser. Works fine in Safari 2.x on 10.4.10 as well as Firefox on 10.5.
Comment 1 Mark Rowe (bdash) 2007-10-31 03:49:05 PDT
Jonas, do you have a URL that can be used to reproduce this issue?
Comment 2 Mark Rowe (bdash) 2007-10-31 03:54:44 PDT
Never mind, I wrote up http://bdash.net.nz/files/redirect-to-mailto.php which demonstrates the issue.  It's not clear which protocols are affected.  I've retitled the bug to cover only mailto, as http://bdash.net.nz/files/redirect-to-ftp.php shows that ftp:// works correctly.
Comment 3 Mark Rowe (bdash) 2007-10-31 03:55:25 PDT
Comment 4 Mark Rowe (bdash) 2007-10-31 04:23:28 PDT
WebKit nightly builds on Tiger don't exhibit this problem which suggests that this behaviour is due to a change outside of WebKit. 

Setting a breakpoint on -[WebCoreResourceHandleAsDelegate connection:willSendRequest:redirectResponse:] on both Tiger and Leopard reveals different behaviour.  On Tiger it is called with a URL connection and request associated with the mailto: URL.  On Leopard it is called once with the original URL, as the comment indicates is expected due to a change in behaviour on Leopard, and is never called again.  Instead -[WebCoreResourceHandleAsDelegate connection:didFailWithError:] is called with a connection of <NSURLConnection: 0x15464cf0, http://bdash.net.nz/files/redirect-to-mailto.php> and error of <Error Domain=NSURLErrorDomain Code=-1002 UserInfo=0x1c367f00 "unsupported URL">.

As this strongly suggests the change in behaviour is outside of WebKit, I think that this bug should be closed as INVALID.
Comment 5 Jonas Walldén 2007-10-31 04:53:16 PDT
Yes, it's probably correct that it falls outside WebKit since I haven't seen the problem with recent nightlies on 10.4 so feel free to close this as INVALID.

Anyway, for reference I can report that I first noticed this in our product where we have a custom URL protocol registered (roxencms:) so I guess this extends to all custom protocols such as ssh:, itms: and many others and not just mailto: (which I chose in since it's easily tested). I'd appreciate if the Radar ticket makes this clear so the fix isn't limited to mailto:.
Comment 6 Mark Rowe (bdash) 2007-10-31 05:00:22 PDT
Thanks for the additional information.  I've added it to the Radar.  I also threw together <http://bdash.net.nz/files/redirect-to-itms.php> which demonstrates that non-mailto protocols are definitely affected as you stated.

Closing as INVALID now due to the fact that the issue here is outside of WebKit.  Thanks for the report!