Giter Site home page Giter Site logo

Comments (2)

Teshootub7 avatar Teshootub7 commented on August 25, 2024

Additional info:

Sorry, I forgot to provide an example...
All you need to use "transparent gzip decompression" is done by:

clnt.transparent_gzip_decompression = true

Then you can retrieve a document as usual.

res = clnt.get("http://www.debian.org/")

The document is transferred with gzip compressed.

res.header["Content-Encoding"]
=> ["gzip"]
res.header["Content-Length"]
=> ["4422"]
res.content.length
=> 13942

And you can read the content without knowing it is compressed or not.

puts res.content
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <title>Debian -- The Universal Operating System </title>
....

Regards,

from httpclient.

nahi avatar nahi commented on August 25, 2024

Added transparent_gzip_decompression property. closed by 95964f1.

Applied a patch from Teshootub7. With setting
HTTPClient#transparent_gzip_decompression = true, HTTPClient tries to do
gzip/deflate content transmission. Following explanation is by
Teshootub7.

All you need to use "transparent gzip decompression" is done by:

clnt.transparent_gzip_decompression = true

Then you can retrieve a document as usual.

res = clnt.get("http://www.debian.org/")

The document is transferred with gzip compressed.

res.header["Content-Encoding"]
=> ["gzip"]
res.header["Content-Length"]
=> ["4422"]
res.content.length
=> 13942

And you can read the content without knowing it is compressed or not.

from httpclient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.