mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-06 00:02:08 -04:00
fixing retry protocol bug for not-completely-flushed requests
a bug was found where in certain cases, a server responds with an error before the request fully buffers the body. Under retries, the request is reset, however, the http/2 conn handler kept the last chunk around, which it would flush before writing the second request body, resulting in byte-accounting issues. Therefore, response clean up request state before yielding.
This commit is contained in:
parent
9ca4cbe68b
commit
fd28741a97
@ -226,6 +226,10 @@ module HTTPX
|
||||
end
|
||||
|
||||
def on_stream_close(stream, request, error)
|
||||
log(level: 2) { "#{stream.id}: closing stream" }
|
||||
@drains.delete(request)
|
||||
@streams.delete(request)
|
||||
|
||||
if error && error != :no_error
|
||||
ex = Error.new(stream.id, error)
|
||||
ex.set_backtrace(caller)
|
||||
@ -241,9 +245,6 @@ module HTTPX
|
||||
emit(:response, request, response)
|
||||
end
|
||||
end
|
||||
log(level: 2) { "#{stream.id}: closing stream" }
|
||||
|
||||
@streams.delete(request)
|
||||
send(@pending.shift) unless @pending.empty?
|
||||
return unless @streams.empty? && exhausted?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user