LWP and gzip

S

sprint

New to perl and experimenting with LWP.

However I have come across some website content that comes down as
"content-encoding: gzip" followed by a few hundred bytes of
gobbledegook.

Can someone point me to some sample code to de-crypt this on the fly,
please

Thanks
 
S

Sam Holden

New to perl and experimenting with LWP.

However I have come across some website content that comes down as
"content-encoding: gzip" followed by a few hundred bytes of
gobbledegook.

Can someone point me to some sample code to de-crypt this on the fly,
please

I'd guess that the uncompress function in Compress::Zlib might do the trick.

However, it seems a bit "rude" for a web server to send gzip encoded
stuff unless you specified it in the Accept-Encoding header of the request.
 
G

Gregory Toomey

New to perl and experimenting with LWP.

However I have come across some website content that comes down as
"content-encoding: gzip" followed by a few hundred bytes of
gobbledegook.

Can someone point me to some sample code to de-crypt this on the fly,
please

Thanks

You are proabably downloading a file stored in zip format on the server.
Archive::zip (available from www.cpan.org) works with plain zip files.

On Linux I would call the Linux utilities "gunzip" or "zcat", using the Perl
"system" command, to unzip the file.

gtoomey
 
N

news

However I have come across some website content that comes down as
"content-encoding: gzip" followed by a few hundred bytes of
gobbledegook.

The webserver shouldn't provide content with gzip encoding unless your
client has offered that capability. Complain to the website provider.
Can someone point me to some sample code to de-crypt this on the fly,
please

Feed the data content through one of the many gzip modules
(e.g. Compress:Zlib or maybe PerlIO::gzip) to uncompress it.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,137
Messages
2,570,795
Members
47,342
Latest member
eixataze

Latest Threads

Top