mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-06 00:02:08 -04:00
In order to expose other auth schemes in proxy, the basic, digest and ntlm modules were extracted from the plugins, these being left with the request management. So now, an extra parameter, `:scheme`, can be passed (it'll be "basic" for http and "socks5" for socks5 by default, can also be "digest" or "ntlm", haven't tested those yet).
49 lines
1.3 KiB
Plaintext
49 lines
1.3 KiB
Plaintext
module HTTPX
|
|
class HTTPProxyError < Error
|
|
end
|
|
|
|
module Plugins
|
|
module Proxy
|
|
Error: singleton(HTTPProxyError)
|
|
PROXY_ERRORS: Array[singleton(StandardError)]
|
|
|
|
class Parameters
|
|
attr_reader uri: URI::Generic
|
|
attr_reader username: String?
|
|
attr_reader password: String?
|
|
attr_reader scheme: String?
|
|
|
|
def can_authenticate?: (*untyped) -> boolish
|
|
|
|
def authenticate: (*untyped) -> String?
|
|
|
|
def ==: (untyped) -> bool
|
|
|
|
private
|
|
|
|
def initialize: (uri: generic_uri, ?scheme: String, ?username: String, ?password: String, **extra) -> untyped
|
|
end
|
|
|
|
def self.configure: (singleton(Session)) -> void
|
|
|
|
type proxyParam = Parameters | Hash[Symbol, untyped]
|
|
|
|
interface _ProxyOptions
|
|
def proxy: () -> proxyParam?
|
|
end
|
|
|
|
def self.extra_options: (Options) -> (Options & _ProxyOptions)
|
|
|
|
module InstanceMethods
|
|
private
|
|
|
|
def proxy_uris: (generic_uri, Options & _ProxyOptions) -> { uri: generic_uri, username: String, password: String }
|
|
| (generic_uri, Options & _ProxyOptions) -> { uri: generic_uri }
|
|
| (generic_uri, Options & _ProxyOptions) -> nil
|
|
end
|
|
end
|
|
|
|
type sessionProxy = Session & Proxy::InstanceMethods
|
|
end
|
|
end
|