Workaround for IE Overly Accepting in Rails’ respond_to format

Looks like Microsoft’s Internet Explorer will accept any format a web server is willing to give it.

This doesn’t play nicely with Rails’ 2.0+ respond_to feature. A slick little bit of code that asks the browser what it wants and replies accordingly.

Here’s a conversation between Rails & Firefox

Firefox: “Hey Rails, I want this url”
Rails: “No problem, which format would you like it in?”
Firefox: “HTML, please.”
Rails: “Here you go.”

Here’s the same conversation with Internet Explorer

IE: “Hey Rails, I want this url”
Rails: “No problem, which format would you like it in?”
IE: “Whatcha got?”
Rails: “I’ve got Atom, and…”
IE: (interputting) “OK THANKS!”
Rails: “…um, what? I wasn’t finished, really? ok, here you go.”

I had ordered my code alphabetically, so ‘atom‘ came before ‘html‘, like this:

respond_to do |format|
format.atom
format.html

end

Because IE is so, um, accepting, I’ve needed to put ‘html‘ first:

respond_to do |format|
format.html
format.atom

end

For more on this issue:

How to SFTP into a Virtual Server on Your Joyent Accelerator

I’m finally getting around to setting up my Joyent Accelerator.

As I read through the ‘Getting Started with Joyent Accelerator’ wiki, things were going smoothly.

Updating the nameserver at my registrar was unexpectedly fast and easy, as was signing into webmin, setting up a virtual server, a subversion repo, and a couple users.

Now, which of the half dozen name/pass combos do I use for SFTP?
Answer: The admin of the virtual server.

How to find these credentials:

  1. Select ‘Edit Virtual Server’
  2. Expand ‘Configurable Settings’
  3. Click ‘Show…’

Now SFTP in, and everything should look as expected.

Wednesday, March 7, 2007 11:33:43 AM

I wasn’t getting the upload speeds I was expecting. Not by a long shot. After troubleshooting the dsl line and the modem itself, the Speakeasy rep and I determined the Linksys WRT54G router was the issue. Upgrading the firmware to v4.21.1 didn’t improve anything. Then, after poking around the router’s admin settings, I found the culprit: Quality of Service (QoS) on Upstream Bandwidth was enabled. Disabling it gave me 2.5x the uploading speeds.