camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryce Ewing <bryc...@gmail.com>
Subject Error with RSS component accessing gzip content
Date Sat, 17 Jul 2010 09:42:39 GMT

Hi,

I have found at least one site that responds to a request for their RSS feed
with gzipped content, without being asked to.  If you request the URL using
curl (with no options) you get binary (gzipped) data back if you use curl
--compressed then curl expects this and displays the content in ascii.

What this means for the Camel RSS component is that in this block of code
(RssUtils):
        InputStream in = new URL(feedUri).openStream();
        SyndFeedInput input = new SyndFeedInput();
        return input.build(new XmlReader(in));
The content that comes out of the input stream is gzipped content and when
it is parsed an exception is thrown:
        Invalid XML: Error on line 1: Content is not allowed in prolog.

A simple test in the debugger at this point in the code showed that using a
GZIPInputStream worked, but then that wouldn't work for a non gzipped
stream.

Firstly I am wondering if anyone has come across this before, whether there
is a work around, or maybe I am plain doing something wrong?

Secondly if this indeed in something to be fixed I am willing to look into a
solution (thinking that a more robust http client might catch this through
reading the response headers, which do contain: "Content-Encoding: gzip").

Thoughts?

Cheers
Bryce
-- 
View this message in context: http://camel.465427.n5.nabble.com/Error-with-RSS-component-accessing-gzip-content-tp1335918p1335918.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message