Repository navigation
Replies: 1 comment 1 reply
|
You're checking the response after decompression has completed. In So the sequence is:
The private To inspect the encoded response, disable automatic decompression before receiving it. The UA's transactor supports use feature 'say';
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
$ua->transactor->compressed(0);
my $res = $ua->get('https://mojolicious.org' => {'Accept-Encoding' => 'gzip'})->result;
say $res->content->is_compressed ? 'gzip' : 'not gzip';This still depends on the server actually choosing gzip. Also, the last command has |
Uh oh!
There was an error while loading. Please reload this page.
I'm looking for help with understanding the handling of compression.
Tapping into a typical HTTP response, we can see that the Content-Encoding is not marked gzip, but is being decompressed anyway:
But even with an explicit gzip, the content is still not detected as compressed:
But with Accept-Encoding: identity, it is not being decompressed:
Why do none of these situations return true for
is_compressed? What situation would create a trueis_compressedcontent? And why doesCompress::Raw::Zlib::Inflateget involved ifis_compressedis false?All reactions