mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-08 00:02:42 -04:00
revert deactivation of expect when receiving an 100 response
This commit is contained in:
parent
2f210d81e1
commit
32eebe6d9d
@ -38,6 +38,23 @@ module HTTPX
|
||||
|
||||
@headers["expect"] = "100-continue"
|
||||
end
|
||||
|
||||
def response=(response)
|
||||
super
|
||||
|
||||
return unless @response && @response == 100 &&
|
||||
!@request.headers.key?("expect") &&
|
||||
(@state == :body || @state == :done)
|
||||
|
||||
# if we're past this point, this means that we just received a 100-Continue response,
|
||||
# but the request doesn't have the expect flag, and is already flushing (or flushed) the body.
|
||||
#
|
||||
# this means that expect was deactivated for this request too soon, i.e. response took longer.
|
||||
#
|
||||
# so we have to reactivate it again.
|
||||
request.headers["expect"] = "100-continue"
|
||||
@response = nil
|
||||
end
|
||||
end
|
||||
|
||||
module ConnectionMethods
|
||||
|
Loading…
x
Reference in New Issue
Block a user