View Rahoul Baruah's profile on LinkedIn Basecamp project management and collaboration

The blog of Rahoul Baruah from 3hv Ltd

What's going on?

My name is Rahoul Baruah (aka Baz) and I'm a software developer in Leeds (England).

This is a log of things I've discovered while writing software in Ruby on Rails. In other words, geek stuff.

However, I've decided to put this blog on ice - I would ask you to check out my business blog here (or subscribe here).

23 January, 2007

Safari, So Good, So What!

I rewrote my application to take advantage of the new Restful Urls in Rails (an article on this coming up). I also got rid of the messy session-managed login code and thought I would use a nice and easy HTTP authentication scheme (so my eventual API can use the same mechanism as the main application - plus it minimises that "nasty" server-side state).

All my tests passed. Nice.
I ran through the local application in Camino. Nice.
I capistranoed onto the server. Nice.
I ran through the deployed application in Safari (I wanted to grab some screenshots and I use Shapeshifter - I leave Safari unskinned just for this). Boo! Some of the links didn't work.

I examined production.log. The filter chain has been halted - no yield. I examined the Rails source code. Why is the filter chain being halted? I looked through the HTTP Authentication source code. It looks like it is working correctly. Why are only some links not working? The authentication is obviously working for part of the application.

Then I noticed. It was the new-style Urls that were failing ... http://myserver.com/thingies/34;edit - it's the semi-colon! A few more tests proved it.

And then the killer. It works fine in IE (both 6 and 7). It works fine in Camino. It works fine in Firefox. It's just Safari. Apple's flagship browser doesn't work with Apple-loving Rails. I then tested in OmniWeb ... no joy there either. So WebKit doesn't like Restful Rails.

A quick search later digs up this article - with a fix. Basically it overrides url_for and examines the User Agent - if it's AppleWebKit then Url-escape the semicolons. My Urls look ugly but at least they work.

No comments:

eXTReMe Tracker