mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-12-07 00:00:31 -05:00
typing selector and connection
This commit is contained in:
parent
4c61c524ed
commit
beb0a82baa
@ -1,2 +1,87 @@
|
||||
class HTTPX::Connection
|
||||
module HTTPX
|
||||
class Connection
|
||||
type ipaddr = IPAddr | String
|
||||
|
||||
interface _Parser
|
||||
|
||||
def on: (Symbol) { (*untyped) -> void } -> void
|
||||
def empty?: () -> bool
|
||||
def close: () -> void
|
||||
def consume: () -> void
|
||||
def <<: (string) -> void
|
||||
end
|
||||
|
||||
include Loggable
|
||||
include Callbacks
|
||||
extend HTTPX::Registry[String, Class]
|
||||
|
||||
attr_reader origin: generic_uri
|
||||
attr_reader state: Symbol
|
||||
attr_reader pending: Array[Request]
|
||||
attr_reader options: options
|
||||
|
||||
def addresses: () -> Array[ipaddr]?
|
||||
|
||||
def addresses=: (Array[ipaddr]) -> void
|
||||
|
||||
def match?: (generic_uri, options) -> bool
|
||||
|
||||
def mergeable?: (Connection) -> bool
|
||||
|
||||
def coalescable?: (Connection) -> bool
|
||||
|
||||
def create_idle: (options) -> Connection
|
||||
| () -> Connection
|
||||
|
||||
def merge: (Connection) -> void
|
||||
|
||||
def purge_pending: () { (Request) -> void } -> void
|
||||
|
||||
def match_altsvcs?: (generic_uri) -> bool
|
||||
|
||||
def connecting?: () -> bool
|
||||
def inflight?: () -> boolish
|
||||
|
||||
def interests: () -> io_interests?
|
||||
|
||||
def to_io: () -> _ToIO
|
||||
|
||||
def call: () -> void
|
||||
|
||||
def close: () -> void
|
||||
def reset: () -> void
|
||||
|
||||
def send: (Request) -> void
|
||||
|
||||
def timeout: () -> Numeric?
|
||||
|
||||
private
|
||||
|
||||
def initialize: (String, generic_uri, options) -> untyped
|
||||
|
||||
def connect: () -> void
|
||||
|
||||
def exhausted?: () -> boolish
|
||||
|
||||
def consume: () -> void
|
||||
|
||||
def send_pending: () -> void
|
||||
|
||||
def parser: () -> _Parser
|
||||
|
||||
def build_parser: () -> _Parser
|
||||
| (String) -> _Parser
|
||||
|
||||
def set_parser_callbacks: (_Parser) -> void
|
||||
|
||||
def transition: (Symbol) -> void
|
||||
|
||||
def handle_response: () -> void
|
||||
|
||||
def on_error: (StandardError) -> void
|
||||
|
||||
def handle_error: (StandardError) -> void
|
||||
|
||||
def total_timeout: () -> Timers::Timer?
|
||||
end
|
||||
end
|
||||
4
sig/connection/http1.rbs
Normal file
4
sig/connection/http1.rbs
Normal file
@ -0,0 +1,4 @@
|
||||
module HTTPX
|
||||
class Connection::HTTP1
|
||||
end
|
||||
end
|
||||
@ -4,6 +4,7 @@ module HTTPX
|
||||
VERSION: String
|
||||
|
||||
type uri = URI::HTTP | URI::HTTPS | string
|
||||
type generic_uri = uri | URI::Generic
|
||||
|
||||
type verb = :options | :get | :head | :post | :put | :delete | :trace | :connect |
|
||||
:propfind | :proppatch | :mkcol | :copy | :move | :lock | :unlock | :orderpatch |
|
||||
|
||||
@ -18,7 +18,7 @@ module HTTPX
|
||||
|
||||
private
|
||||
|
||||
def initialize: (uri: uri | URI::Generic, ?username: string, ?password: string) -> untyped
|
||||
def initialize: (uri: generic_uri, ?username: string, ?password: string) -> untyped
|
||||
end
|
||||
|
||||
def self.configure: (singleton(Session)) -> void
|
||||
|
||||
20
sig/selector.rbs
Normal file
20
sig/selector.rbs
Normal file
@ -0,0 +1,20 @@
|
||||
module HTTPX
|
||||
class Selector
|
||||
READABLE: :r | :rw
|
||||
WRITABLE: :w | :rw
|
||||
|
||||
def register: (_ToIO) -> void
|
||||
def deregister: (_ToIO) -> void
|
||||
|
||||
def select: (Numeric?) { (_ToIO) -> void } -> void
|
||||
|
||||
private
|
||||
|
||||
def initialize: () -> untyped
|
||||
|
||||
def select_many: (Numeric?) { (_ToIO) -> void } -> void
|
||||
def select_one: (Numeric?) { (_ToIO) -> void } -> void
|
||||
end
|
||||
|
||||
type io_interests = :r | :w | :rw
|
||||
end
|
||||
@ -33,7 +33,7 @@ if [[ ${RUBY_VERSION:0:1} = "3" ]]; then
|
||||
export RUBYOPT='-rbundler/setup -rrbs/test/setup'
|
||||
export RBS_TEST_RAISE=true
|
||||
export RBS_TEST_LOGLEVEL=error
|
||||
export RBS_TEST_OPT='-Isig -ruri -rjson'
|
||||
export RBS_TEST_OPT='-Isig -ruri -rjson -ripaddr'
|
||||
export RBS_TEST_TARGET='HTTPX*'
|
||||
fi
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user