Downloading a page compressed

Downloading a page compressed

am 30.12.2004 00:58:17 von orasnita

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

Re: Downloading a page compressed

am 30.12.2004 01:02:29 von derhoermi

* 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@smtp.bjoern.hoehrma nn.de

for some details.
--
Björn Höhrmann · mailto:bjoern@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/

Re: Downloading a page compressed

am 30.12.2004 03:58:10 von Andy

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@petdance.com => www.petdance.com => AIM:petdance

Re: Downloading a page compressed

am 30.12.2004 13:42:26 von gisle

Andy Lester 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

Re: Downloading a page compressed

am 30.12.2004 15:37:05 von Andy

>>
>> 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@petdance.com => www.petdance.com => AIM:petdance