summaryrefslogtreecommitdiff
path: root/lib/net/http.rb
diff options
context:
space:
mode:
authorBurdetteLamar <burdettelamar@yahoo.com>2023-02-09 22:52:01 +0000
committergit <svn-admin@ruby-lang.org>2023-02-13 13:04:33 +0000
commitbc6e587e86a4a4a46af3b1c2fbe1ff3b399735a6 (patch)
tree1aaa07513fdf08c40660e7668313b1fc66e754ee /lib/net/http.rb
parent9821f6d0e5957a680bb4ce39708ebc86e23d85d0 (diff)
[ruby/net-http] Enhanced RDoc for Compression
https://github.com/ruby/net-http/commit/cff88acd70
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r--lib/net/http.rb28
1 files changed, 23 insertions, 5 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 8084bf349f..5ca4df28d8 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -428,13 +428,31 @@ module Net #:nodoc:
# http = Net::HTTP.new('example.com', nil, 'my.proxy', 8000, 'pname', 'ppass', 'my.proxy,proxy.example:8000')
# http.proxy_address # => nil
#
- # == Compression
+ # == Compression and Decompression
#
- # \Net::HTTP automatically adds Accept-Encoding for compression of response
- # bodies and automatically decompresses gzip and deflate responses unless a
- # Range header was sent.
+ # \Net::HTTP does not compress the body of a request before sending.
#
- # Compression can be disabled through the Accept-Encoding: identity header.
+ # By default, \Net::HTTP adds header <tt>'Accept-Encoding'</tt>
+ # to a new {request object}[rdoc-ref:Net::HTTPRequest]:
+ #
+ # Net::HTTP::Get.new(uri)['Accept-Encoding']
+ # # => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
+ #
+ # This requests the server to zip-encode the response body if there is one;
+ # the server is not required to do so.
+ #
+ # \Net::HTTP does not automatically decompress a response body
+ # if the response has header <tt>'Content-Range'</tt>.
+ #
+ # Otherwise decompression (or not) depends on the value of header
+ # {Content-Encoding}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-encoding-response-header]:
+ #
+ # - <tt>'deflate'</tt>, <tt>'gzip'</tt>, or <tt>'x-gzip'</tt>:
+ # decompresses the body and deletes the header.
+ # - <tt>'none'</tt> or <tt>'identity'</tt>:
+ # does not decompress the body, but deletes the header.
+ # - Any other value:
+ # leaves the body and header unchanged.
#
class HTTP < Protocol