@@ -428,13 +428,31 @@ class HTTPHeaderSyntaxError < StandardError; end
428
428
# http = Net::HTTP.new('example.com', nil, 'my.proxy', 8000, 'pname', 'ppass', 'my.proxy,proxy.example:8000')
429
429
# http.proxy_address # => nil
430
430
#
431
- # == Compression
431
+ # == Compression and Decompression
432
432
#
433
- # \Net::HTTP automatically adds Accept-Encoding for compression of response
434
- # bodies and automatically decompresses gzip and deflate responses unless a
435
- # Range header was sent.
433
+ # \Net::HTTP does not compress the body of a request before sending.
436
434
#
437
- # Compression can be disabled through the Accept-Encoding: identity header.
435
+ # By default, \Net::HTTP adds header <tt>'Accept-Encoding'</tt>
436
+ # to a new {request object}[rdoc-ref:Net::HTTPRequest]:
437
+ #
438
+ # Net::HTTP::Get.new(uri)['Accept-Encoding']
439
+ # # => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
440
+ #
441
+ # This requests the server to zip-encode the response body if there is one;
442
+ # the server is not required to do so.
443
+ #
444
+ # \Net::HTTP does not automatically decompress a response body
445
+ # if the response has header <tt>'Content-Range'</tt>.
446
+ #
447
+ # Otherwise decompression (or not) depends on the value of header
448
+ # {Content-Encoding}[https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#content-encoding-response-header]:
449
+ #
450
+ # - <tt>'deflate'</tt>, <tt>'gzip'</tt>, or <tt>'x-gzip'</tt>:
451
+ # decompresses the body and deletes the header.
452
+ # - <tt>'none'</tt> or <tt>'identity'</tt>:
453
+ # does not decompress the body, but deletes the header.
454
+ # - Any other value:
455
+ # leaves the body and header unchanged.
438
456
#
439
457
class HTTP < Protocol
440
458
0 commit comments