On 30/11/2006, at 12:09 AM, Thijs van der Vossen wrote:

>
> On Nov 25, 2006, at 12:01 AM, Tim Lucas wrote:
>> On 25/11/2006, at 6:35 AM, Thijs van der Vossen wrote:
>>> There's currently a bug in Safari, or more likely somewhere in  
>>> the OS
>>> X HTTP API that breaks HTTP Authentication when there is a semicolon
>>> in the path part of the URL. This means it's impossible to use HTTP
>>> Authentication when you're building a RESTful Rails app that  
>>> needs to
>>> work in Safari.
>>
>> I stumbled across this in September, and it required this ugly, ugly
>> work around:
>> http://toolmantim.com/article/2006/9/19/
>> safari_urls_the_semi_colon_and_one_night_in_paris
>>
>> Thanks for raising the issue properly and trying to get it addressed.
>
> Great idea to try escaping the semicolon!
> For those interested, you can work around this issue by adding the
> following to your ApplicationController in app/controllers/
> application.rb:
>
>    # make HTTP Authentication work on Safari for RESTful Rails
>    alias_method :orig_url_for, :url_for
>    def url_for(options = {}, *parameters_for_method_reference)
>      result = orig_url_for(options, parameters_for_method_reference)
>      if request.env['HTTP_USER_AGENT'].to_s.include? 'AppleWebKit'
>        result.is_a?(String) ? result.gsub(';', '%3B') : result
>      else
>        result
>      end
>    end

Thanks Thijs, updated accordingly (with slightly cleaner code):
http://toolmantim.com/article/2006/9/19/ 
safari_urls_the_semi_colon_and_one_night_in_paris

-- tim



--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Ruby on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to