Menu

#28 Accept-encoding: deflate not set, even with Compress::Zlib

open
nobody
None
5
2003-04-12
2003-04-12
Ed Avis
No

The page <http://rudolf.org.uk/dumprequest.html> shows
the http headers sent by the requester of a page. It
shows that LWP is not sending the Accept-encoding
header, even though Compress::Zlib is installed and was
installed before LWP.

I can see that the header 'Te: deflate, gzip' is in the
request, but shouldn't Accept-Encoding be in there too?

Steps to reproduce:

- Start with perl-5.8.0.
- Install Compress::Zlib version 1.19.
- Install URI version 1.23 and then libwww-perl 5.69.
- Run the following program adapted from the LWP manual
page:

#!/usr/bin/perl

use warnings;

use strict;

# Create a user agent object
use LWP::UserAgent;
my $ua = new LWP::UserAgent();

# Create a request
my $req = HTTP::Request->new(GET =>
'http://rudolf.org.uk/dumprequest.html');
####$req->header('Accept-Encoding' => [ 'deflate',
'gzip' ]);

# Pass request to the user agent and get a response back
my $res = $ua->request($req);

# Check the outcome of the response
if ($res->is_success) {
print $res->content;
}
else {
print "Bad luck this time\n";
}

- Look at the HTML returned from the site (sorry that
it is not easy to view as plain text) and see that
Accept-Encoding isn't there, not unless you uncomment
the line beginning ####.

Expected result: the headers sent to fetch the page
would include 'Accept-Encoding: deflate', since
Compress::Zlib is installed and LWP should be able to
transparently decompress.

Actual result: no Accept-Encoding header is present.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.