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.
Jonas, do you have a URL that can be used to reproduce this issue?
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.
<rdar://problem/5570518>
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.
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:.
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!