lib/httpx/response/body.rb in httpx-1.2.0 vs lib/httpx/response/body.rb in httpx-1.2.1
- old
+ new
@@ -164,10 +164,11 @@
@buffer.rewind
end
private
+ # prepares inflaters for the advertised encodings in "content-encoding" header.
def initialize_inflaters
@inflaters = nil
return unless @headers.key?("content-encoding")
@@ -185,17 +186,19 @@
@encodings << encoding
inflater
end
end
+ # passes the +chunk+ through all inflaters to decode it.
def decode_chunk(chunk)
@inflaters.reverse_each do |inflater|
chunk = inflater.call(chunk)
end if @inflaters
chunk
end
+ # tries transitioning the body STM to the +nextstate+.
def transition(nextstate)
case nextstate
when :open
return unless @state == :idle