mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
updated signatures of IO objects
This commit is contained in:
parent
6aacc9b0eb
commit
d699526ec2
@ -1,11 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "forwardable"
|
||||
|
||||
module HTTPX
|
||||
class UNIX < TCP
|
||||
extend Forwardable
|
||||
|
||||
using URIExtensions
|
||||
|
||||
attr_reader :path
|
||||
@ -13,7 +9,7 @@ module HTTPX
|
||||
alias_method :host, :path
|
||||
|
||||
def initialize(origin, addresses, options)
|
||||
@addresses = addresses
|
||||
@addresses = []
|
||||
@hostname = origin.host
|
||||
@state = :idle
|
||||
@options = Options.new(options)
|
||||
|
14
sig/io/ssl.rbs
Normal file
14
sig/io/ssl.rbs
Normal file
@ -0,0 +1,14 @@
|
||||
module HTTPX
|
||||
IPRegex: Regexp
|
||||
|
||||
class SSL < TCP
|
||||
TLS_OPTIONS: Hash[Symbol, untyped]
|
||||
|
||||
def can_verify_peer?: () -> bool
|
||||
|
||||
def verify_hostname: (String host) -> bool
|
||||
|
||||
# :nocov:
|
||||
def try_ssl_connect: () -> void
|
||||
end
|
||||
end
|
57
sig/io/tcp.rbs
Normal file
57
sig/io/tcp.rbs
Normal file
@ -0,0 +1,57 @@
|
||||
module HTTPX
|
||||
class TCP
|
||||
include Loggable
|
||||
|
||||
attr_reader ip: IPAddr?
|
||||
|
||||
attr_reader port: Integer
|
||||
|
||||
attr_reader addresses: Array[ipaddr]
|
||||
|
||||
attr_reader state: Symbol
|
||||
|
||||
attr_reader interests: Symbol
|
||||
|
||||
alias host ip
|
||||
|
||||
def initialize: (URI::Generic origin, Array[ipaddr]? addresses, options options) -> void
|
||||
|
||||
def add_addresses: (Array[ipaddr] addrs) -> void
|
||||
|
||||
def to_io: () -> ::IO
|
||||
|
||||
def protocol: () -> String
|
||||
|
||||
def connect: () -> void
|
||||
|
||||
private
|
||||
|
||||
# :nocov:
|
||||
def try_connect: () -> void
|
||||
|
||||
public
|
||||
|
||||
def read: (Integer size, ?(Buffer | String) buffer) -> (0 | nil | untyped)
|
||||
|
||||
def write: (Buffer buffer) -> Integer?
|
||||
|
||||
def close: () -> void
|
||||
|
||||
def connected?: () -> bool
|
||||
|
||||
def closed?: () -> bool
|
||||
|
||||
# :nocov:
|
||||
def inspect: () -> ::String
|
||||
|
||||
private
|
||||
|
||||
def build_socket: () -> Socket
|
||||
|
||||
def transition: (Symbol nextstate) -> void
|
||||
|
||||
def do_transition: (Symbol nextstate) -> void
|
||||
|
||||
def log_transition_state: (Symbol nextstate) -> void
|
||||
end
|
||||
end
|
20
sig/io/udp.rbs
Normal file
20
sig/io/udp.rbs
Normal file
@ -0,0 +1,20 @@
|
||||
module HTTPX
|
||||
class UDP
|
||||
include Loggable
|
||||
|
||||
def initialize: (String ip, Integer port, Options options) -> void
|
||||
|
||||
def to_io: () -> ::IO
|
||||
|
||||
def connect: () -> void
|
||||
|
||||
def connected?: () -> bool
|
||||
|
||||
# :nocov:
|
||||
def close: () -> void
|
||||
|
||||
def read: (Integer size, ?(Buffer | String) buffer) -> Integer?
|
||||
|
||||
def write: (Buffer buffer) -> Integer?
|
||||
end
|
||||
end
|
10
sig/io/unix.rbs
Normal file
10
sig/io/unix.rbs
Normal file
@ -0,0 +1,10 @@
|
||||
module HTTPX
|
||||
class UNIX < TCP
|
||||
|
||||
attr_reader path: String
|
||||
|
||||
alias host path
|
||||
|
||||
def initialize: (URI::HTTP | URI::HTTPS origin, Array[String]? addresses, options options) -> void
|
||||
end
|
||||
end
|
@ -21,6 +21,7 @@ module HTTPX
|
||||
@read_buffer: String
|
||||
@write_buffer: Buffer
|
||||
@large_packet: Buffer?
|
||||
@io: UDP | TCP
|
||||
|
||||
attr_reader state: Symbol
|
||||
|
||||
@ -55,7 +56,7 @@ module HTTPX
|
||||
|
||||
def generate_candidates: (String) -> Array[String]
|
||||
|
||||
def build_socket: () -> void
|
||||
def build_socket: () -> (UDP | TCP)
|
||||
|
||||
def transition: (Symbol nextstate) -> void
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user