On a recent trip to the USA, Scott stayed in a hotel with a ‘net connection. The connection was one of those with an arbitrary web-based registration that made sure you’d agreed to their ass-covering terms of service. Until you had agreed, the hotel’s proxy would redirect any HTTP connection to the registration page… using the 301 status code.
Within a few seconds of plugging in the ethernet cable, all of Scott’s RSS subscriptions had been silently replaced with the hotel’s registration page URL. All the original feed URLs were lost.
Considering this, Gordon writes:
Lots of aggregator developers have been burned by the hotel proxy problem. The problem is that as a developer who read the spec, you tend to think that other developers did the same. The interesting thing is what to do with the 301. So you ask the user if they want to accept the redirect. Does the user even understand what that means? Let's see, "Some server is saying that the resource at http://example.com/rss.xml has moved to dumbhotelproxy.com. Do you want to change your subscription?" Considering the amount of effort people are putting into making it easy to subscribe to an RSS feed (because the users don't know what to do with XML, or the orange XML button), I have no idea how to pose that question such that the user might actually do the right thing.
I ran across this one myself over 2 years ago with BottomFeeder (thank goodness I back up feeds at startup!). I stay in hotels that have 12 or 24 hour subscriptions often enough that I wanted a permanent solution to this problem, so I came up with one:
- When I see a redirect, I cache the old address
- If I see more than a handful (default: 3) of redirects to the same place, I stop the update loop and restore the old urls
Here's the code I use to make that call:
httpRedirectEvent: anUrl "we got a redirect - check to see if we have more than one this cycle that went the same place. If so, assume that we have a proxy of some sort, and revert it all back" self redirects add: anUrl. (self redirects occurrencesOf: anUrl) > self tooManyRedirects ifTrue: [self resetOriginalsAndStopUpdates: anUrl. self redirects: OrderedCollection new].
Each redirect generates an event, which ends up in that method. You can see how it works, and it's saved me from this problem more than once. Now, how easy do other frameworks make it for you to do this sort of thing? I have no idea. It was a few minutes work to solve it in Smalltalk though