Downloading a page compressed

Hi,

Please tell me how can I use the $request->header() in order to request a
page in compressed format (with gzip).


Thank you.

Teddy
orasnita [ Do, 30 Dezember 2004 00:58 ] [ ID #558641 ]

Re: Downloading a page compressed

* Octavian Rasnita wrote:
>Please tell me how can I use the $request->header() in order to request a
>page in compressed format (with gzip).

HTTP/1.1 uses the "TE" and "Accept-Encoding" headers to specify that the
client supports gzip compression. LWP should take care of the TE header
automatically if the relevant modules are installed, in order to specify
the Accept-Encoding header you can use

$request->header(Accept_Encoding => 'gzip')

Note that LWP does not automatically remove the gzip compression in this
case and that there is no gurantee that the resource will indeed be gzip
compressed by the server. If it is, this should be indicated in the
Content-Encoding header. For some resources it is however common that it
is not indicated in the response that the resource is compressed, see

http://www.w3.org/mid/41b3c1cd.228828328 [at] smtp.bjoern.hoehrma nn.de

for some details.
--
Björn Höhrmann · mailto:bjoern [at] hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
derhoermi [ Do, 30 Dezember 2004 01:02 ] [ ID #558642 ]

Re: Downloading a page compressed

On Dec 29, 2004, at 6:02 PM, Bjoern Hoehrmann wrote:
>
> Note that LWP does not automatically remove the gzip compression in
> this
> case

WWW::Mechanize does, however.

xoxo,
Andy

--
Andy Lester => andy [at] petdance.com => www.petdance.com => AIM:petdance
Andy [ Do, 30 Dezember 2004 03:58 ] [ ID #558643 ]

Re: Downloading a page compressed

Andy Lester <andy [at] petdance.com> writes:

> On Dec 29, 2004, at 6:02 PM, Bjoern Hoehrmann wrote:
> >
> > Note that LWP does not automatically remove the gzip compression in
> > this
> > case
>
> WWW::Mechanize does, however.

And LWP does it if you ask for the $response->decoded_content instead
of $response->content. The decoded_content method was introduced in
LWP-5.802.

Regards,
Gisle
gisle [ Do, 30 Dezember 2004 13:42 ] [ ID #559404 ]

Re: Downloading a page compressed

>>
>> WWW::Mechanize does, however.
>
> And LWP does it if you ask for the $response->decoded_content instead
> of $response->content. The decoded_content method was introduced in
> LWP-5.802.

I was unaware of this. I'll have to have Mech use LWP's decompression.

xoxo,
Andy

--
Andy Lester => andy [at] petdance.com => www.petdance.com => AIM:petdance
Andy [ Do, 30 Dezember 2004 15:37 ] [ ID #559405 ]
Perl » perl.libwww » Downloading a page compressed

Vorheriges Thema: no net access by default
Nächstes Thema: Minor bugs in libwww-perl-5.803 fixed in Debian