Snoopy’s RSS Hell

I’ve been fighting the good fight against RSS bugs in Moodle 1.8.2. The problem isn’t actually with Moodle, but with Snoopy, the PHP class that emulates as a web browser and which Magpie RSS library uses to fetch the feeds.

It seems that the current version of Snoopy has some issues with redirected URLs. It has trouble following 302 Page Moved messages and has an annoying habit of putting the port number into redirected URLs. While it’s not technically wrong to do this, not every web server thinks that the urls and are the same (strange but true).

Case in point: The Wall Street Journal. The following feeds involve redirects (apparently served through FeedBurner, so I’m betting any feed using FeedBurner would have the same issue):

I was able to get the feeds working by using the hack outlined in this bug report, which changes the code so that it only inserts a port number into the address if it’s not :80. Technically these are 302 redirects, but that particular bug doesn’t appear to be affecting us. Not sure why; it may be we haven’t found just the right feed to break it yet.