Skip to content

Commit

Permalink
Add rbs files
Browse files Browse the repository at this point in the history
  • Loading branch information
znz committed Oct 28, 2024
1 parent 9350944 commit 6bbf177
Show file tree
Hide file tree
Showing 34 changed files with 1,800 additions and 0 deletions.
24 changes: 24 additions & 0 deletions sig/accesslog.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module WEBrick
module AccessLog
class AccessLogError < StandardError
end

CLF_TIME_FORMAT: String

COMMON_LOG_FORMAT: String

CLF: String

REFERER_LOG_FORMAT: String

AGENT_LOG_FORMAT: String

COMBINED_LOG_FORMAT: String

def self?.setup_params: (Hash[Symbol, untyped] config, HTTPRequest req, HTTPResponse res) -> Hash[String, untyped]

def self?.format: (String format_string, Hash[String, untyped] params) -> String

def self?.escape: (String data) -> String
end
end
92 changes: 92 additions & 0 deletions sig/cgi.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
module WEBrick
class CGI
@options: Array[untyped]

class CGIError < StandardError
end

attr_reader config: Hash[Symbol, untyped]

attr_reader logger: BasicLog

def initialize: (*untyped args) -> void

def []: (Symbol key) -> untyped

interface _Env
def []: (String) -> String?
end

def start: (?_Env env, ?IO stdin, ?IO stdout) -> void

def self.setup_header: () -> untyped

def self.status_line: () -> ""

def service: (HTTPRequest req, HTTPResponse res) -> void

class Socket
@config: Hash[Symbol, untyped]

@env: _Env

@header_part: StringIO

@body_part: IO

@out_port: IO

@server_addr: String

@server_name: String?

@server_port: String?

@remote_addr: String?

@remote_host: String?

@remote_port: (String | 0)

include Enumerable[String]

private

def initialize: (Hash[Symbol, untyped] config, _Env env, IO stdin, IO stdout) -> void

def request_line: () -> String

def setup_header: () -> void

def add_header: (String hdrname, String value) -> void

def input: () -> (IO | StringIO)

public

def peeraddr: () -> [nil, (String | 0), String?, String?]

def addr: () -> [nil, String?, String?, String]

def gets: (?String eol, ?Integer? size) -> String?

def read: (?Integer? size) -> String?

def each: () { (String) -> void } -> void

def eof?: () -> bool

def <<: (_ToS data) -> IO

def write: (_ToS data) -> Integer

def cert: () -> OpenSSL::X509::Certificate?

def peer_cert: () -> OpenSSL::X509::Certificate?

def peer_cert_chain: () -> Array[OpenSSL::X509::Certificate]?

def cipher: () -> [String?, String?, String?, String?]?
end
end
end
18 changes: 18 additions & 0 deletions sig/compat.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# System call error module used by webrick for cross platform compatibility.
#
# EPROTO:: protocol error
# ECONNRESET:: remote host reset the connection request
# ECONNABORTED:: Client sent TCP reset (RST) before server has accepted the
# connection requested by client.
#
module Errno
class EPROTO < SystemCallError
end

class ECONNRESET < SystemCallError
end

class ECONNABORTED < SystemCallError
end
end
17 changes: 17 additions & 0 deletions sig/config.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module WEBrick
module Config
LIBDIR: String

# for GenericServer
General: Hash[Symbol, untyped]

# for HTTPServer, HTTPRequest, HTTPResponse ...
HTTP: Hash[Symbol, untyped]

FileHandler: Hash[Symbol, untyped]

BasicAuth: Hash[Symbol, untyped]

DigestAuth: Hash[Symbol, untyped]
end
end
37 changes: 37 additions & 0 deletions sig/cookie.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module WEBrick
class Cookie
@expires: String?

attr_reader name: String?

attr_accessor value: String?

attr_accessor version: Integer

#
# The cookie domain
attr_accessor domain: String?

attr_accessor path: String?

attr_accessor secure: true?

attr_accessor comment: String?

attr_accessor max_age: Integer?

def initialize: (untyped name, untyped value) -> void

def expires=: ((Time | _ToS)? t) -> untyped

def expires: () -> Time?

def to_s: () -> String

def self.parse: (String? str) -> Array[instance]?

def self.parse_set_cookie: (String str) -> instance

def self.parse_set_cookies: (String str) -> Array[instance]
end
end
5 changes: 5 additions & 0 deletions sig/htmlutils.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module WEBrick
module HTMLUtils
def self?.escape: (String? string) -> String
end
end
13 changes: 13 additions & 0 deletions sig/httpauth.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module WEBrick
module HTTPAuth
interface _Callable
def call: (String user, String pass) -> bool
end

def self?._basic_auth: (HTTPRequest req, HTTPResponse res, String realm, String req_field, String res_field, HTTPStatus::Error err_type, _Callable block) -> void

def self?.basic_auth: (HTTPRequest req, HTTPResponse res, String realm) { (String user, String pass) -> bool } -> void

def self?.proxy_basic_auth: (HTTPRequest req, HTTPResponse res, String realm) { (String user, String pass) -> bool } -> void
end
end
55 changes: 55 additions & 0 deletions sig/httpauth/authenticator.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module WEBrick
module HTTPAuth
module Authenticator
@reload_db: bool?

@request_field: String

@response_field: String

@resp_info_field: String

@auth_exception: singleton(HTTPStatus::ClientError)

@auth_scheme: String

RequestField: String

ResponseField: String

ResponseInfoField: String

AuthException: singleton(HTTPStatus::ClientError)

AuthScheme: String?

attr_reader realm: String?

attr_reader userdb: UserDB

attr_reader logger: Log

private

def check_init: (Hash[Symbol, untyped] config) -> void

def check_scheme: (HTTPRequest req) -> String?

def log: (interned meth, String fmt, *untyped args) -> void

def error: (String fmt, *untyped args) -> void

def info: (String fmt, *untyped args) -> void
end

module ProxyAuthenticator
RequestField: String

ResponseField: String

InfoField: String

AuthException: singleton(HTTPStatus::ClientError)
end
end
end
29 changes: 29 additions & 0 deletions sig/httpauth/basicauth.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module WEBrick
module HTTPAuth
class BasicAuth
@config: Hash[Symbol, untyped]

include Authenticator

AuthScheme: String

def self.make_passwd: (String? realm, String? user, String? pass) -> String

attr_reader realm: String?

attr_reader userdb: UserDB

attr_reader logger: Log

def initialize: (Hash[Symbol, untyped] config, ?Hash[Symbol, untyped] default) -> void

def authenticate: (HTTPRequest req, HTTPResponse res) -> void

def challenge: (HTTPRequest req, HTTPResponse res) -> bot
end

class ProxyBasicAuth < BasicAuth
include ProxyAuthenticator
end
end
end
85 changes: 85 additions & 0 deletions sig/httpauth/digestauth.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
module WEBrick
module HTTPAuth
class DigestAuth
@config: Hash[Symbol, untyped]

@domain: Array[String]?

@use_opaque: bool

@use_next_nonce: bool

@check_nc: bool

@use_auth_info_header: bool

@nonce_expire_period: Integer

@nonce_expire_delta: Integer

@internet_explorer_hack: bool

@h: singleton(Digest::Base)

@instance_key: String

@opaques: Hash[String, OpaqueInfo]

@last_nonce_expire: Time

@mutex: Thread::Mutex

include Authenticator

AuthScheme: String

class OpaqueInfo < Struct[untyped]
attr_accessor time(): Time
attr_accessor nonce(): String?
attr_accessor nc(): String
end

attr_reader algorithm: String?

attr_reader qop: Array[String]

def self.make_passwd: (String realm, String user, String pass) -> untyped

def initialize: (Hash[Symbol, untyped] config, ?Hash[Symbol, untyped] default) -> void

def authenticate: (HTTPRequest req, HTTPResponse res) -> void

def challenge: (HTTPRequest req, HTTPResponse res, ?bool stale) -> bot

private

MustParams: Array[String]

MustParamsAuth: Array[String]

def _authenticate: (HTTPRequest req, HTTPResponse res) -> (:nonce_is_stale | bool)

def split_param_value: (String string) -> Hash[String, String]

def generate_next_nonce: (HTTPRequest req) -> String

def check_nonce: (HTTPRequest req, Hash[String, String] auth_req) -> bool

def generate_opaque: (HTTPRequest req) -> String

def check_opaque: (OpaqueInfo opaque_struct, untyped req, Hash[String, String] auth_req) -> bool

def check_uri: (HTTPRequest req, Hash[String, String] auth_req) -> bool

def hexdigest: (*_ToS? args) -> String
end

class ProxyDigestAuth < DigestAuth
include ProxyAuthenticator

private

def check_uri: (HTTPRequest req, Hash[String, String] auth_req) -> true
end
end
end
Loading

0 comments on commit 6bbf177

Please sign in to comment.