mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-08 00:02:42 -04:00
adding :close_handshake_timeout timeout option
used to monitor readiness of connection to write the last goaway frame from HTTP/2
This commit is contained in:
parent
7345c19d5d
commit
100394b29c
@ -73,8 +73,11 @@ module HTTPX
|
|||||||
end
|
end
|
||||||
|
|
||||||
def close
|
def close
|
||||||
@connection.goaway unless @connection.state == :closed
|
|
||||||
emit(:close)
|
emit(:close)
|
||||||
|
unless @connection.state == :closed
|
||||||
|
@connection.goaway
|
||||||
|
emit(:timeout, @options.timeout[:close_handshake_timeout])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def empty?
|
def empty?
|
||||||
|
@ -11,6 +11,7 @@ module HTTPX
|
|||||||
MAX_BODY_THRESHOLD_SIZE = (1 << 10) * 112 # 112K
|
MAX_BODY_THRESHOLD_SIZE = (1 << 10) * 112 # 112K
|
||||||
KEEP_ALIVE_TIMEOUT = 20
|
KEEP_ALIVE_TIMEOUT = 20
|
||||||
SETTINGS_TIMEOUT = 10
|
SETTINGS_TIMEOUT = 10
|
||||||
|
CLOSE_HANDSHAKE_TIMEOUT = 10
|
||||||
CONNECT_TIMEOUT = READ_TIMEOUT = WRITE_TIMEOUT = 60
|
CONNECT_TIMEOUT = READ_TIMEOUT = WRITE_TIMEOUT = 60
|
||||||
REQUEST_TIMEOUT = OPERATION_TIMEOUT = nil
|
REQUEST_TIMEOUT = OPERATION_TIMEOUT = nil
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ module HTTPX
|
|||||||
:timeout => {
|
:timeout => {
|
||||||
connect_timeout: CONNECT_TIMEOUT,
|
connect_timeout: CONNECT_TIMEOUT,
|
||||||
settings_timeout: SETTINGS_TIMEOUT,
|
settings_timeout: SETTINGS_TIMEOUT,
|
||||||
|
close_handshake_timeout: CLOSE_HANDSHAKE_TIMEOUT,
|
||||||
operation_timeout: OPERATION_TIMEOUT,
|
operation_timeout: OPERATION_TIMEOUT,
|
||||||
keep_alive_timeout: KEEP_ALIVE_TIMEOUT,
|
keep_alive_timeout: KEEP_ALIVE_TIMEOUT,
|
||||||
read_timeout: READ_TIMEOUT,
|
read_timeout: READ_TIMEOUT,
|
||||||
|
@ -9,9 +9,10 @@ module HTTPX
|
|||||||
OPERATION_TIMEOUT: Integer
|
OPERATION_TIMEOUT: Integer
|
||||||
KEEP_ALIVE_TIMEOUT: Integer
|
KEEP_ALIVE_TIMEOUT: Integer
|
||||||
SETTINGS_TIMEOUT: Integer
|
SETTINGS_TIMEOUT: Integer
|
||||||
|
CLOSE_HANDSHAKE_TIMEOUT: Integer
|
||||||
DEFAULT_OPTIONS: Hash[Symbol, untyped]
|
DEFAULT_OPTIONS: Hash[Symbol, untyped]
|
||||||
|
|
||||||
type timeout_type = :connect_timeout | :settings_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :request_timeout
|
type timeout_type = :connect_timeout | :settings_timeout | :close_handshake_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :request_timeout
|
||||||
type timeout = Hash[timeout_type, Numeric?]
|
type timeout = Hash[timeout_type, Numeric?]
|
||||||
|
|
||||||
def self.new: (?options) -> instance
|
def self.new: (?options) -> instance
|
||||||
|
@ -80,6 +80,7 @@ class OptionsTest < Minitest::Test
|
|||||||
:timeout => {
|
:timeout => {
|
||||||
connect_timeout: 60,
|
connect_timeout: 60,
|
||||||
settings_timeout: 10,
|
settings_timeout: 10,
|
||||||
|
close_handshake_timeout: 10,
|
||||||
operation_timeout: nil,
|
operation_timeout: nil,
|
||||||
keep_alive_timeout: 20,
|
keep_alive_timeout: 20,
|
||||||
read_timeout: 60,
|
read_timeout: 60,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user