perl http request with accept encoding "gzip"
The following gist shows an example of a perl http request with gzip compression active for the received content. And when the content is gziped, it must be decompressed too.
If you have some perl http request and you have not yet enabled gzip compression on your requests, you can do so following the simple instructions:
my useragent will be HTTP::Tiny by default, but these settings can serve as base for any user agent interface.
Instanciate your useragent with defaultheaders options, so it accepts gzip by default ie:
HTTP::Tiny->new(
defaultheaders => {
'Accept-Encoding' => 'gzip'
}
)decompress the content (see method decompress on the link below)
see the code: https://gist.github.com/hernan604/7083667
[]s
hernan604
Written by Hernan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Perl
Authors
janosgyerik
25.11K
Jean-Remy Duboc
12.22K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#