Skip to content

Commit

Permalink
more sig completeness
Browse files Browse the repository at this point in the history
  • Loading branch information
HoneyryderChuck committed Dec 10, 2024
1 parent 36ddd84 commit e418783
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 5 deletions.
1 change: 0 additions & 1 deletion lib/httpx/plugins/aws_sigv4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class << self
def load_dependencies(*)
require "set"
require "digest/sha2"
require "openssl"
end

def configure(klass)
Expand Down
2 changes: 2 additions & 0 deletions lib/httpx/plugins/webdav.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def lock(path, timeout: nil, &blk)
ensure
unlock(path, lock_token)
end

response
end

def unlock(path, lock_token)
Expand Down
2 changes: 2 additions & 0 deletions sig/chainable.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module HTTPX
| (:oauth, ?options) -> Plugins::sessionOAuth
| (:callbacks, ?options) -> Plugins::sessionCallbacks
| (:content_digest, ?options) -> Plugins::sessionContentDigest
| (:ssrf_filter, ?options) -> Plugins::sessionSsrf
| (:webdav, ?options) -> Plugins::sessionWebDav
| (:xml, ?options) -> Plugins::sessionXML
| (Symbol | Module, ?options) { (Class) -> void } -> Session
| (Symbol | Module, ?options) -> Session
Expand Down
8 changes: 7 additions & 1 deletion sig/plugins/aws_sigv4.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ module HTTPX


class Signer

@credentials: Object & _SigV4Credentials
@service: String
@region: String
@unsigned_headers: Set[String]
@apply_checksum_header: bool
@provider_prefix: String
@header_provider_field: String
@algorithm: String

def sign!: (Request & RequestMethods request) -> void

Expand Down
9 changes: 9 additions & 0 deletions sig/plugins/cookies/cookie.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ module HTTPX

attr_reader created_at: Time

@for_domain: bool

@domain_name: DomainName

def path=: (string) -> void

def domain=: (string) -> void
Expand All @@ -43,6 +47,11 @@ module HTTPX
| (_ToS, _ToS, ?cookie_attributes) -> untyped

def acceptable_from_uri?: (uri) -> bool

module Scanner
RE_BAD_CHAR: Regexp
def self?.quote: (String s) -> String
end
end
end
end
4 changes: 4 additions & 0 deletions sig/plugins/grpc/call.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module HTTPX
class Call
attr_writer decoder: _Callable

@response: Response | StreamResponse
@consumed: bool
@grpc_response: Enumerator[String] | String

def metadata: () -> headers

def trailing_metadata: () -> headers?
Expand Down
14 changes: 11 additions & 3 deletions sig/plugins/proxy/socks5.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ module HTTPX
module Proxy
module Socks5
VERSION: Integer
NOAUTH: Integer
PASSWD: Integer
NONE: Integer
CONNECT: Integer
IPV4: Integer
DOMAIN: Integer
IPV6: Integer
SUCCESS: Integer

module ConnectionMethods
def __socks5_proxy_connect: () -> void
Expand All @@ -31,9 +39,9 @@ module HTTPX
end

module Packet
def self?.negotiate: (Parameters) -> String
def self?.authenticate: (Parameters) -> String
def self?.connect: (uri) -> String
def self?.negotiate: (Parameters parameters) -> String
def self?.authenticate: (Parameters parameters) -> String
def self?.connect: (uri uri) -> String
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions sig/plugins/push_promise.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ module HTTPX
module Plugins
module PushPromise
module ResponseMethods
@__pushed: bool?

def pushed?: () -> boolish
def mark_as_pushed!: () -> void
end

module InstanceMethods
@promise_headers: Hash[::HTTP2::Stream, Request]?
private

def promise_headers: () -> Hash[::HTTP2::Stream, Request]
Expand Down
2 changes: 2 additions & 0 deletions sig/plugins/rate_limiter.rbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module HTTPX
module Plugins
module RateLimiter
RATE_LIMIT_CODES: Array[Integer]

def self.load_dependencies: (singleton(Session)) -> void

def self.retry_on_rate_limited_response: (_Response) -> bool
Expand Down
26 changes: 26 additions & 0 deletions sig/plugins/ssrf_filter.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module HTTPX
class ServerSideRequestForgeryError < Error
end

module Plugins
module SsrfFilter
IPV4_BLACKLIST: Array[IPAddr]

IPV6_BLACKLIST: Array[[IPAddr, IPAddr]]

def self?.unsafe_ip_address?: (IPAddr) -> bool

interface _Options
def allowed_schemes: () -> Array[String]
end

module InstanceMethods
end

module ConnectionMethods
end
end

type sessionSsrf = Session & SsrfFilter::InstanceMethods
end
end
23 changes: 23 additions & 0 deletions sig/plugins/webdav.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module HTTPX
module Plugins
module WebDav
module InstanceMethods
def copy: (String src, String dst) -> (Response | ErrorResponse)

def move: (String src, String dst) -> (Response | ErrorResponse)

def lock: (String path, ?timeout: Numeric) ?{ (Response response) -> void } -> (Response | ErrorResponse)

def unlock: (String path, String? lock_token) -> (Response | ErrorResponse)

def mkcol: (String dir) -> Response

def propfind: (String path, ?(:acl | String) xml) -> Response

def proppatch: (String path, String xml) -> Response
end
end

type sessionWebDav = Session & WebDav::InstanceMethods
end
end

0 comments on commit e418783

Please sign in to comment.