Today someone posted on ColdFusion forum regarding this problem where cffeed was not able to handle a particular URL and it was throwing an error. The URL which he tried was http://movies.msn.com/rss/topcelebs and it failed with an error
“Unable to read the source URL.
unknown compression method”
The reason it happens is – The URL returns the response in gzip compressed format only. So when ColdFusion sent a request to this URL and asked for uncompressed data, it could not get anything and hence it was unable to read it. A simpe workaround for this is to use cfhttp to fetch the content, write to a temporary file and then use the cffeed tag to read this file. Important thing to keep in mind here is to set an additional header in the cfhttp tag using cfhttpparam to indicate that it can accept compressed data as well.
Here is the modified code where it first tries cffeed with the URL. If that fails, then it tries to use cfhttp to fetch the content and writes to a temporary file and then uses it in cffeed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <cfset tempDir=GetTempDirectory()> <cfset tempFile = GetTempFile(tempDir, "myfeed")> <cfset tempFileName = GetFileInfo(tempFile).name> <cftry> <cffeed action="read" source="http://movies.msn.com/rss/topcelebs" name="feedInStruct" > <cfcatch any> <cfhttp url="http://movies.msn.com/rss/topcelebs" path="#tempDir#" file="#tempFileName#"> <cfhttpparam type="header" name="Accept-Encoding" value="compress,gzip,deflate"> </cfhttp> <cffeed action="read" source="#tempFile#" name="feedInStruct" > </cfcatch> </cftry> <cfif FileExists(tempFile)> <cfset FileDelete(tempFile)> </cfif> <cfdump var="#feedInStruct#"> |

#1 by Claude on August 3rd, 2007
| Quote
So is this a bug? Shouldn’t CFFEED send the accept headers automatically?
#2 by Hemant on August 4th, 2007
| Quote
This was discovered late in the cycle. Its alredy logged.
Nice post Rupesh!
#3 by Raymond on September 16th, 2007
| Quote
Was this fixed in the CHF for CF8?
#4 by Raymond Camden on April 8th, 2011
| Quote
I just hit this in 901. Still not fixed?
#5 by Raymond Camden on April 8th, 2011
| Quote
Also – unless I’m blind, path/file is not documented in the CFML reference.
#6 by Raymond Camden on April 8th, 2011
| Quote
Ah – it is listed in the top part of the reference for CFHTTP, but is not described in the table of attributes.
#7 by Raymond Camden on April 8th, 2011
| Quote
It looks like path does not like using the VFS.
#8 by Raymond Camden on April 8th, 2011
| Quote
Ok I apologize – it is listed a bit lower. Still though – is this bug still there in CFFEED? Sure seems to be.