webrick 1.8.1 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/README.md +2 -0
- data/Rakefile +0 -7
- data/lib/webrick/cgi.rb +1 -1
- data/lib/webrick/httpauth/authenticator.rb +4 -4
- data/lib/webrick/httpauth/htgroup.rb +1 -1
- data/lib/webrick/httpauth/htpasswd.rb +2 -2
- data/lib/webrick/httpproxy.rb +4 -4
- data/lib/webrick/httprequest.rb +42 -14
- data/lib/webrick/httpresponse.rb +1 -1
- data/lib/webrick/httpserver.rb +2 -2
- data/lib/webrick/httpservlet/abstract.rb +1 -1
- data/lib/webrick/httpservlet/filehandler.rb +6 -6
- data/lib/webrick/httputils.rb +34 -14
- data/lib/webrick/server.rb +1 -1
- data/lib/webrick/version.rb +1 -1
- data/sig/accesslog.rbs +24 -0
- data/sig/cgi.rbs +92 -0
- data/sig/compat.rbs +18 -0
- data/sig/config.rbs +17 -0
- data/sig/cookie.rbs +37 -0
- data/sig/htmlutils.rbs +5 -0
- data/sig/httpauth/authenticator.rbs +55 -0
- data/sig/httpauth/basicauth.rbs +29 -0
- data/sig/httpauth/digestauth.rbs +85 -0
- data/sig/httpauth/htdigest.rbs +31 -0
- data/sig/httpauth/htgroup.rbs +21 -0
- data/sig/httpauth/htpasswd.rbs +31 -0
- data/sig/httpauth/userdb.rbs +13 -0
- data/sig/httpauth.rbs +13 -0
- data/sig/httpproxy.rbs +61 -0
- data/sig/httprequest.rbs +167 -0
- data/sig/httpresponse.rbs +117 -0
- data/sig/https.rbs +49 -0
- data/sig/httpserver.rbs +71 -0
- data/sig/httpservlet/abstract.rbs +36 -0
- data/sig/httpservlet/cgi_runner.rbs +3 -0
- data/sig/httpservlet/cgihandler.rbs +23 -0
- data/sig/httpservlet/erbhandler.rbs +17 -0
- data/sig/httpservlet/filehandler.rbs +76 -0
- data/sig/httpservlet/prochandler.rbs +21 -0
- data/sig/httpservlet.rbs +4 -0
- data/sig/httpstatus.rbs +255 -0
- data/sig/httputils.rbs +116 -0
- data/sig/httpversion.rbs +17 -0
- data/sig/log.rbs +93 -0
- data/sig/manifest.yaml +8 -0
- data/sig/server.rbs +57 -0
- data/sig/ssl.rbs +19 -0
- data/sig/utils.rbs +122 -0
- data/sig/version.rbs +3 -0
- data/webrick.gemspec +35 -0
- metadata +43 -8
data/sig/https.rbs
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
module WEBrick
|
2
|
+
class HTTPRequest
|
3
|
+
@client_cert_chain: Array[OpenSSL::X509::Certificate]
|
4
|
+
|
5
|
+
attr_reader cipher: [String, String, Integer, Integer]?
|
6
|
+
|
7
|
+
attr_reader server_cert: OpenSSL::X509::Certificate
|
8
|
+
|
9
|
+
attr_reader client_cert: OpenSSL::X509::Certificate?
|
10
|
+
|
11
|
+
alias orig_parse parse
|
12
|
+
|
13
|
+
def parse: (?(TCPSocket | OpenSSL::SSL::SSLSocket)? socket) -> void
|
14
|
+
| ...
|
15
|
+
|
16
|
+
alias orig_parse_uri parse_uri
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def parse_uri: (String str, ?::String scheme) -> URI::Generic
|
21
|
+
| ...
|
22
|
+
|
23
|
+
public
|
24
|
+
|
25
|
+
alias orig_meta_vars meta_vars
|
26
|
+
|
27
|
+
def meta_vars: () -> Hash[String, String]
|
28
|
+
| ...
|
29
|
+
end
|
30
|
+
|
31
|
+
class SNIRequest
|
32
|
+
attr_reader host: String?
|
33
|
+
|
34
|
+
attr_reader addr: [String, Integer, String, String]
|
35
|
+
|
36
|
+
attr_reader port: Integer
|
37
|
+
|
38
|
+
def initialize: (OpenSSL::SSL::SSLSocket sslsocket, ?String? hostname) -> void
|
39
|
+
end
|
40
|
+
|
41
|
+
class HTTPServer < ::WEBrick::GenericServer
|
42
|
+
def ssl_servername_callback: (OpenSSL::SSL::SSLSocket sslsocket, ?String? hostname) -> OpenSSL::SSL::SSLContext?
|
43
|
+
|
44
|
+
alias orig_virtual_host virtual_host
|
45
|
+
|
46
|
+
def virtual_host: (instance server) -> void
|
47
|
+
| ...
|
48
|
+
end
|
49
|
+
end
|
data/sig/httpserver.rbs
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
module WEBrick
|
2
|
+
class HTTPServerError < ServerError
|
3
|
+
end
|
4
|
+
|
5
|
+
class HTTPServer < ::WEBrick::GenericServer
|
6
|
+
@http_version: HTTPVersion
|
7
|
+
|
8
|
+
@mount_tab: MountTable
|
9
|
+
|
10
|
+
@virtual_hosts: Array[untyped]
|
11
|
+
|
12
|
+
def initialize: (?Hash[Symbol, untyped] config, ?Hash[Symbol, untyped] default) -> void
|
13
|
+
|
14
|
+
def run: (TCPSocket sock) -> void
|
15
|
+
|
16
|
+
def service: (HTTPRequest req, HTTPResponse res) -> void
|
17
|
+
|
18
|
+
def do_OPTIONS: (HTTPRequest req, HTTPResponse res) -> void
|
19
|
+
|
20
|
+
def mount: (String dir, singleton(HTTPServlet::AbstractServlet) servlet, *untyped options) -> void
|
21
|
+
|
22
|
+
def mount_proc: (String dir, ?HTTPServlet::ProcHandler::_Callable proc) -> void
|
23
|
+
| (String dir, ?nil proc) { (HTTPRequest, HTTPResponse) -> void } -> void
|
24
|
+
|
25
|
+
def unmount: (String dir) -> MountTable::value_type
|
26
|
+
|
27
|
+
alias umount unmount
|
28
|
+
|
29
|
+
def search_servlet: (String path) -> [singleton(HTTPServlet::AbstractServlet), Array[untyped], String, String]?
|
30
|
+
|
31
|
+
def virtual_host: (instance server) -> void
|
32
|
+
|
33
|
+
def lookup_server: (HTTPRequest req) -> instance?
|
34
|
+
|
35
|
+
def access_log: (Hash[Symbol, untyped] config, HTTPRequest req, HTTPResponse res) -> void
|
36
|
+
|
37
|
+
#
|
38
|
+
# Creates the HTTPRequest used when handling the HTTP
|
39
|
+
# request. Can be overridden by subclasses.
|
40
|
+
def create_request: (Hash[Symbol, untyped] with_webrick_config) -> HTTPRequest
|
41
|
+
|
42
|
+
#
|
43
|
+
# Creates the HTTPResponse used when handling the HTTP
|
44
|
+
# request. Can be overridden by subclasses.
|
45
|
+
def create_response: (Hash[Symbol, untyped] with_webrick_config) -> HTTPResponse
|
46
|
+
|
47
|
+
class MountTable
|
48
|
+
type value_type = [singleton(HTTPServlet::AbstractServlet), Array[untyped]]
|
49
|
+
|
50
|
+
@tab: Hash[String, value_type]
|
51
|
+
|
52
|
+
@scanner: Regexp
|
53
|
+
|
54
|
+
def initialize: () -> void
|
55
|
+
|
56
|
+
def []: (String dir) -> value_type
|
57
|
+
|
58
|
+
def []=: (String dir, value_type val) -> value_type
|
59
|
+
|
60
|
+
def delete: (String dir) -> value_type
|
61
|
+
|
62
|
+
def scan: (String path) -> [String, String]
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def compile: () -> void
|
67
|
+
|
68
|
+
def normalize: (String dir) -> String
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPServlet
|
3
|
+
class HTTPServletError < StandardError
|
4
|
+
end
|
5
|
+
|
6
|
+
class AbstractServlet
|
7
|
+
@server: HTTPServer
|
8
|
+
|
9
|
+
interface _Config
|
10
|
+
def []: (Symbol) -> untyped
|
11
|
+
end
|
12
|
+
|
13
|
+
@config: _Config
|
14
|
+
|
15
|
+
@logger: Log
|
16
|
+
|
17
|
+
@options: untyped # Array[untyped] causes RBS::InstanceVariableTypeError
|
18
|
+
|
19
|
+
def self.get_instance: (HTTPServer server, *untyped options) -> instance
|
20
|
+
|
21
|
+
def initialize: (HTTPServer server, *untyped options) -> void
|
22
|
+
|
23
|
+
def service: (HTTPRequest req, HTTPResponse res) -> void
|
24
|
+
|
25
|
+
def do_GET: (HTTPRequest req, HTTPResponse res) -> bot
|
26
|
+
|
27
|
+
def do_HEAD: (HTTPRequest req, HTTPResponse res) -> bot
|
28
|
+
|
29
|
+
def do_OPTIONS: (HTTPRequest req, HTTPResponse res) -> void
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def redirect_to_directory_uri: (HTTPRequest req, HTTPResponse res) -> void
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPServlet
|
3
|
+
class CGIHandler < AbstractServlet
|
4
|
+
@script_filename: String
|
5
|
+
|
6
|
+
@tempdir: String?
|
7
|
+
|
8
|
+
@cgicmd: Array[String] | String
|
9
|
+
|
10
|
+
Ruby: String
|
11
|
+
|
12
|
+
CGIRunner: String
|
13
|
+
|
14
|
+
CGIRunnerArray: [String, String]
|
15
|
+
|
16
|
+
def initialize: (HTTPServer server, String name) -> void
|
17
|
+
|
18
|
+
def do_GET: (HTTPRequest req, HTTPResponse res) -> void
|
19
|
+
|
20
|
+
alias do_POST do_GET
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPServlet
|
3
|
+
class ERBHandler < AbstractServlet
|
4
|
+
@script_filename: String
|
5
|
+
|
6
|
+
def initialize: (HTTPServer server, String name) -> void
|
7
|
+
|
8
|
+
def do_GET: (HTTPRequest req, HTTPResponse res) -> void
|
9
|
+
|
10
|
+
alias do_POST do_GET
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def evaluate: (ERB erb, HTTPRequest servlet_request, HTTPResponse servlet_response) -> String
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPServlet
|
3
|
+
class DefaultFileHandler < AbstractServlet
|
4
|
+
@local_path: String
|
5
|
+
|
6
|
+
def initialize: (HTTPServer server, String local_path) -> void
|
7
|
+
|
8
|
+
def do_GET: (HTTPRequest req, HTTPResponse res) -> void
|
9
|
+
|
10
|
+
def not_modified?: (HTTPRequest req, HTTPResponse res, Time mtime, String etag) -> bool
|
11
|
+
|
12
|
+
# returns a lambda for webrick/httpresponse.rb send_body_proc
|
13
|
+
def multipart_body: (File body, Array[[Numeric, Numeric]] parts, String boundary, String mtype, Integer filesize) -> HTTPResponse::_CallableBody
|
14
|
+
|
15
|
+
def make_partial_content: (HTTPRequest req, HTTPResponse res, String filename, Integer filesize) -> void
|
16
|
+
|
17
|
+
def prepare_range: (Range[Integer] range, Integer filesize) -> [Numeric, Numeric]
|
18
|
+
end
|
19
|
+
|
20
|
+
class FileHandler < AbstractServlet
|
21
|
+
@config: AbstractServlet::_Config
|
22
|
+
|
23
|
+
@logger: Log
|
24
|
+
|
25
|
+
@root: String
|
26
|
+
|
27
|
+
@options: Hash[Symbol, untyped]
|
28
|
+
|
29
|
+
HandlerTable: Hash[String, singleton(AbstractServlet)]
|
30
|
+
|
31
|
+
def self.add_handler: (String suffix, singleton(AbstractServlet) handler) -> singleton(AbstractServlet)
|
32
|
+
|
33
|
+
def self.remove_handler: (String suffix) -> singleton(AbstractServlet)
|
34
|
+
|
35
|
+
def initialize: (HTTPServer server, String root, ?Hash[Symbol, untyped] options, ?Hash[Symbol, untyped] default) -> void
|
36
|
+
|
37
|
+
def set_filesystem_encoding: (String str) -> String
|
38
|
+
|
39
|
+
def service: (HTTPRequest req, HTTPResponse res) -> void
|
40
|
+
|
41
|
+
def do_GET: (HTTPRequest req, HTTPResponse res) -> void
|
42
|
+
|
43
|
+
def do_POST: (HTTPRequest req, HTTPResponse res) -> void
|
44
|
+
|
45
|
+
def do_OPTIONS: (HTTPRequest req, HTTPResponse res) -> void
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def trailing_pathsep?: (String path) -> bool
|
50
|
+
|
51
|
+
def prevent_directory_traversal: (HTTPRequest req, HTTPResponse res) -> void
|
52
|
+
|
53
|
+
def exec_handler: (HTTPRequest req, HTTPResponse res) -> bool
|
54
|
+
|
55
|
+
def get_handler: (HTTPRequest req, HTTPResponse res) -> singleton(AbstractServlet)
|
56
|
+
|
57
|
+
def set_filename: (HTTPRequest req, HTTPResponse res) -> bool
|
58
|
+
|
59
|
+
def check_filename: (HTTPRequest req, HTTPResponse res, String name) -> void
|
60
|
+
|
61
|
+
def shift_path_info: (HTTPRequest req, HTTPResponse res, String path_info, ?String? base) -> void
|
62
|
+
|
63
|
+
def search_index_file: (HTTPRequest req, HTTPResponse res) -> String?
|
64
|
+
|
65
|
+
def search_file: (HTTPRequest req, HTTPResponse res, String basename) -> String?
|
66
|
+
|
67
|
+
def call_callback: (Symbol callback_name, HTTPRequest req, HTTPResponse res) -> void
|
68
|
+
|
69
|
+
def windows_ambiguous_name?: (String name) -> bool
|
70
|
+
|
71
|
+
def nondisclosure_name?: (String name) -> bool
|
72
|
+
|
73
|
+
def set_dir_list: (HTTPRequest req, HTTPResponse res) -> void
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPServlet
|
3
|
+
class ProcHandler < AbstractServlet
|
4
|
+
interface _Callable
|
5
|
+
def call: (WEBrick::HTTPRequest, WEBrick::HTTPResponse) -> void
|
6
|
+
end
|
7
|
+
|
8
|
+
@proc: _Callable
|
9
|
+
|
10
|
+
def get_instance: (HTTPServer server, *untyped options) -> self
|
11
|
+
|
12
|
+
def initialize: (_Callable proc) -> void
|
13
|
+
|
14
|
+
def do_GET: (HTTPRequest request, HTTPResponse response) -> void
|
15
|
+
|
16
|
+
alias do_POST do_GET
|
17
|
+
|
18
|
+
alias do_PUT do_GET
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/sig/httpservlet.rbs
ADDED
data/sig/httpstatus.rbs
ADDED
@@ -0,0 +1,255 @@
|
|
1
|
+
module WEBrick
|
2
|
+
#
|
3
|
+
# This module is used to manager HTTP status codes.
|
4
|
+
#
|
5
|
+
# See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more
|
6
|
+
# information.
|
7
|
+
module HTTPStatus
|
8
|
+
#
|
9
|
+
# Root of the HTTP status class hierarchy
|
10
|
+
class Status < StandardError
|
11
|
+
attr_reader self.code: Integer
|
12
|
+
|
13
|
+
attr_reader self.reason_phrase: String
|
14
|
+
|
15
|
+
# Returns the HTTP status code
|
16
|
+
def code: () -> Integer
|
17
|
+
|
18
|
+
# Returns the HTTP status description
|
19
|
+
def reason_phrase: () -> String
|
20
|
+
|
21
|
+
alias to_i code
|
22
|
+
end
|
23
|
+
|
24
|
+
# Root of the HTTP info statuses
|
25
|
+
class Info < Status
|
26
|
+
end
|
27
|
+
|
28
|
+
# Root of the HTTP success statuses
|
29
|
+
class Success < Status
|
30
|
+
end
|
31
|
+
|
32
|
+
# Root of the HTTP redirect statuses
|
33
|
+
class Redirect < Status
|
34
|
+
end
|
35
|
+
|
36
|
+
# Root of the HTTP error statuses
|
37
|
+
class Error < Status
|
38
|
+
end
|
39
|
+
|
40
|
+
# Root of the HTTP client error statuses
|
41
|
+
class ClientError < Error
|
42
|
+
end
|
43
|
+
|
44
|
+
# Root of the HTTP server error statuses
|
45
|
+
class ServerError < Error
|
46
|
+
end
|
47
|
+
|
48
|
+
class EOFError < StandardError
|
49
|
+
end
|
50
|
+
|
51
|
+
# HTTP status codes and descriptions
|
52
|
+
StatusMessage: Hash[Integer, String]
|
53
|
+
|
54
|
+
# Maps a status code to the corresponding Status class
|
55
|
+
CodeToError: Hash[Integer, singleton(Status)]
|
56
|
+
|
57
|
+
# WEBrick::HTTPStatus::constants.grep(/\ARC_/).map{"#{_1}: #{WEBrick::HTTPStatus.const_get(_1)}"}
|
58
|
+
|
59
|
+
RC_CONTINUE: 100
|
60
|
+
RC_SWITCHING_PROTOCOLS: 101
|
61
|
+
RC_OK: 200
|
62
|
+
RC_CREATED: 201
|
63
|
+
RC_ACCEPTED: 202
|
64
|
+
RC_NON_AUTHORITATIVE_INFORMATION: 203
|
65
|
+
RC_NO_CONTENT: 204
|
66
|
+
RC_RESET_CONTENT: 205
|
67
|
+
RC_PARTIAL_CONTENT: 206
|
68
|
+
RC_MULTI_STATUS: 207
|
69
|
+
RC_MULTIPLE_CHOICES: 300
|
70
|
+
RC_MOVED_PERMANENTLY: 301
|
71
|
+
RC_FOUND: 302
|
72
|
+
RC_SEE_OTHER: 303
|
73
|
+
RC_NOT_MODIFIED: 304
|
74
|
+
RC_USE_PROXY: 305
|
75
|
+
RC_TEMPORARY_REDIRECT: 307
|
76
|
+
RC_BAD_REQUEST: 400
|
77
|
+
RC_UNAUTHORIZED: 401
|
78
|
+
RC_PAYMENT_REQUIRED: 402
|
79
|
+
RC_FORBIDDEN: 403
|
80
|
+
RC_NOT_FOUND: 404
|
81
|
+
RC_METHOD_NOT_ALLOWED: 405
|
82
|
+
RC_NOT_ACCEPTABLE: 406
|
83
|
+
RC_PROXY_AUTHENTICATION_REQUIRED: 407
|
84
|
+
RC_REQUEST_TIMEOUT: 408
|
85
|
+
RC_CONFLICT: 409
|
86
|
+
RC_GONE: 410
|
87
|
+
RC_PRECONDITION_FAILED: 412
|
88
|
+
RC_LENGTH_REQUIRED: 411
|
89
|
+
RC_REQUEST_ENTITY_TOO_LARGE: 413
|
90
|
+
RC_REQUEST_URI_TOO_LARGE: 414
|
91
|
+
RC_UNSUPPORTED_MEDIA_TYPE: 415
|
92
|
+
RC_EXPECTATION_FAILED: 417
|
93
|
+
RC_UNPROCESSABLE_ENTITY: 422
|
94
|
+
RC_LOCKED: 423
|
95
|
+
RC_FAILED_DEPENDENCY: 424
|
96
|
+
RC_REQUEST_RANGE_NOT_SATISFIABLE: 416
|
97
|
+
RC_UPGRADE_REQUIRED: 426
|
98
|
+
RC_PRECONDITION_REQUIRED: 428
|
99
|
+
RC_TOO_MANY_REQUESTS: 429
|
100
|
+
RC_REQUEST_HEADER_FIELDS_TOO_LARGE: 431
|
101
|
+
RC_UNAVAILABLE_FOR_LEGAL_REASONS: 451
|
102
|
+
RC_INTERNAL_SERVER_ERROR: 500
|
103
|
+
RC_NOT_IMPLEMENTED: 501
|
104
|
+
RC_BAD_GATEWAY: 502
|
105
|
+
RC_SERVICE_UNAVAILABLE: 503
|
106
|
+
RC_GATEWAY_TIMEOUT: 504
|
107
|
+
RC_HTTP_VERSION_NOT_SUPPORTED: 505
|
108
|
+
RC_INSUFFICIENT_STORAGE: 507
|
109
|
+
RC_NETWORK_AUTHENTICATION_REQUIRED: 511
|
110
|
+
|
111
|
+
# WEBrick::HTTPStatus::CodeToError.each_value.map{"class #{_1.name.split(/::/).last} < #{_1.superclass.name.split(/::/).last}\nend"}
|
112
|
+
|
113
|
+
class Continue < Info
|
114
|
+
end
|
115
|
+
class SwitchingProtocols < Info
|
116
|
+
end
|
117
|
+
class OK < Success
|
118
|
+
end
|
119
|
+
class Created < Success
|
120
|
+
end
|
121
|
+
class Accepted < Success
|
122
|
+
end
|
123
|
+
class NonAuthoritativeInformation < Success
|
124
|
+
end
|
125
|
+
class NoContent < Success
|
126
|
+
end
|
127
|
+
class ResetContent < Success
|
128
|
+
end
|
129
|
+
class PartialContent < Success
|
130
|
+
end
|
131
|
+
class MultiStatus < Success
|
132
|
+
end
|
133
|
+
class MultipleChoices < Redirect
|
134
|
+
end
|
135
|
+
class MovedPermanently < Redirect
|
136
|
+
end
|
137
|
+
class Found < Redirect
|
138
|
+
end
|
139
|
+
class SeeOther < Redirect
|
140
|
+
end
|
141
|
+
class NotModified < Redirect
|
142
|
+
end
|
143
|
+
class UseProxy < Redirect
|
144
|
+
end
|
145
|
+
class TemporaryRedirect < Redirect
|
146
|
+
end
|
147
|
+
class BadRequest < ClientError
|
148
|
+
end
|
149
|
+
class Unauthorized < ClientError
|
150
|
+
end
|
151
|
+
class PaymentRequired < ClientError
|
152
|
+
end
|
153
|
+
class Forbidden < ClientError
|
154
|
+
end
|
155
|
+
class NotFound < ClientError
|
156
|
+
end
|
157
|
+
class MethodNotAllowed < ClientError
|
158
|
+
end
|
159
|
+
class NotAcceptable < ClientError
|
160
|
+
end
|
161
|
+
class ProxyAuthenticationRequired < ClientError
|
162
|
+
end
|
163
|
+
class RequestTimeout < ClientError
|
164
|
+
end
|
165
|
+
class Conflict < ClientError
|
166
|
+
end
|
167
|
+
class Gone < ClientError
|
168
|
+
end
|
169
|
+
class LengthRequired < ClientError
|
170
|
+
end
|
171
|
+
class PreconditionFailed < ClientError
|
172
|
+
end
|
173
|
+
class RequestEntityTooLarge < ClientError
|
174
|
+
end
|
175
|
+
class RequestURITooLarge < ClientError
|
176
|
+
end
|
177
|
+
class UnsupportedMediaType < ClientError
|
178
|
+
end
|
179
|
+
class RequestRangeNotSatisfiable < ClientError
|
180
|
+
end
|
181
|
+
class ExpectationFailed < ClientError
|
182
|
+
end
|
183
|
+
class UnprocessableEntity < ClientError
|
184
|
+
end
|
185
|
+
class Locked < ClientError
|
186
|
+
end
|
187
|
+
class FailedDependency < ClientError
|
188
|
+
end
|
189
|
+
class UpgradeRequired < ClientError
|
190
|
+
end
|
191
|
+
class PreconditionRequired < ClientError
|
192
|
+
end
|
193
|
+
class TooManyRequests < ClientError
|
194
|
+
end
|
195
|
+
class RequestHeaderFieldsTooLarge < ClientError
|
196
|
+
end
|
197
|
+
class UnavailableForLegalReasons < ClientError
|
198
|
+
end
|
199
|
+
class InternalServerError < ServerError
|
200
|
+
end
|
201
|
+
class NotImplemented < ServerError
|
202
|
+
end
|
203
|
+
class BadGateway < ServerError
|
204
|
+
end
|
205
|
+
class ServiceUnavailable < ServerError
|
206
|
+
end
|
207
|
+
class GatewayTimeout < ServerError
|
208
|
+
end
|
209
|
+
class HTTPVersionNotSupported < ServerError
|
210
|
+
end
|
211
|
+
class InsufficientStorage < ServerError
|
212
|
+
end
|
213
|
+
class NetworkAuthenticationRequired < ServerError
|
214
|
+
end
|
215
|
+
|
216
|
+
#
|
217
|
+
# Returns the description corresponding to the HTTP status +code+
|
218
|
+
#
|
219
|
+
# WEBrick::HTTPStatus.reason_phrase 404
|
220
|
+
# => "Not Found"
|
221
|
+
def self?.reason_phrase: (Integer code) -> String
|
222
|
+
|
223
|
+
#
|
224
|
+
# Is +code+ an informational status?
|
225
|
+
def self?.info?: (Integer code) -> bool
|
226
|
+
|
227
|
+
#
|
228
|
+
# Is +code+ a successful status?
|
229
|
+
def self?.success?: (Integer code) -> bool
|
230
|
+
|
231
|
+
#
|
232
|
+
# Is +code+ a redirection status?
|
233
|
+
def self?.redirect?: (Integer code) -> bool
|
234
|
+
|
235
|
+
#
|
236
|
+
# Is +code+ an error status?
|
237
|
+
def self?.error?: (Integer code) -> bool
|
238
|
+
|
239
|
+
#
|
240
|
+
# Is +code+ a client error status?
|
241
|
+
def self?.client_error?: (Integer code) -> bool
|
242
|
+
|
243
|
+
#
|
244
|
+
# Is +code+ a server error status?
|
245
|
+
def self?.server_error?: (Integer code) -> bool
|
246
|
+
|
247
|
+
#
|
248
|
+
# Returns the status class corresponding to +code+
|
249
|
+
#
|
250
|
+
# WEBrick::HTTPStatus[302]
|
251
|
+
# => WEBrick::HTTPStatus::NotFound
|
252
|
+
#
|
253
|
+
def self.[]: (Integer code) -> singleton(Status)
|
254
|
+
end
|
255
|
+
end
|
data/sig/httputils.rbs
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
module WEBrick
|
2
|
+
CR: String
|
3
|
+
|
4
|
+
LF: String
|
5
|
+
|
6
|
+
CRLF: String
|
7
|
+
|
8
|
+
module HTTPUtils
|
9
|
+
def self?.normalize_path: (String path) -> String
|
10
|
+
|
11
|
+
type mime_types = Hash[String, String]
|
12
|
+
|
13
|
+
DefaultMimeTypes: mime_types
|
14
|
+
|
15
|
+
def self?.load_mime_types: (string | _ToPath file) -> mime_types
|
16
|
+
|
17
|
+
def self?.mime_type: (String filename, mime_types mime_tab) -> String
|
18
|
+
|
19
|
+
class SplitHeader < Array[String]
|
20
|
+
def join: (?String separator) -> String
|
21
|
+
end
|
22
|
+
|
23
|
+
class CookieHeader < Array[String]
|
24
|
+
def join: (?String separator) -> String
|
25
|
+
end
|
26
|
+
|
27
|
+
HEADER_CLASSES: Hash[String, untyped]
|
28
|
+
|
29
|
+
def self?.parse_header: (String raw) -> Hash[String, Array[String]]
|
30
|
+
|
31
|
+
def self?.split_header_value: (String str) -> Array[String]
|
32
|
+
|
33
|
+
def self?.parse_range_header: (String? ranges_specifier) -> Array[Range[Integer]]?
|
34
|
+
|
35
|
+
def self?.parse_qvalues: (String? value) -> Array[String]
|
36
|
+
|
37
|
+
def self?.dequote: (String str) -> String
|
38
|
+
|
39
|
+
def self?.quote: (String str) -> String
|
40
|
+
|
41
|
+
class FormData < String
|
42
|
+
@raw_header: Array[String]
|
43
|
+
|
44
|
+
@header: Hash[String, Array[String]]
|
45
|
+
|
46
|
+
EmptyRawHeader: Array[String]
|
47
|
+
|
48
|
+
EmptyHeader: Hash[String, Array[String]]
|
49
|
+
|
50
|
+
attr_accessor name: String?
|
51
|
+
|
52
|
+
attr_accessor filename: String?
|
53
|
+
|
54
|
+
attr_accessor next_data: instance?
|
55
|
+
|
56
|
+
def initialize: (*String args) -> void
|
57
|
+
|
58
|
+
def []: (*String key) -> String
|
59
|
+
# following is as same as String#[]
|
60
|
+
| (int start, ?int length) -> String?
|
61
|
+
| (range[int?] range) -> String?
|
62
|
+
| (Regexp regexp, ?MatchData::capture backref) -> String?
|
63
|
+
| (String substring) -> String?
|
64
|
+
|
65
|
+
def <<: (String str) -> self
|
66
|
+
|
67
|
+
def append_data: (instance data) -> self
|
68
|
+
|
69
|
+
def each_data: () { (instance) -> void } -> void
|
70
|
+
|
71
|
+
def list: () -> Array[String]
|
72
|
+
|
73
|
+
alias to_ary list
|
74
|
+
|
75
|
+
def to_s: () -> String
|
76
|
+
end
|
77
|
+
|
78
|
+
def self?.parse_query: (String? str) -> Hash[String, FormData]
|
79
|
+
|
80
|
+
interface _EachLine
|
81
|
+
def each_line: () { (String) -> void } -> void
|
82
|
+
end
|
83
|
+
|
84
|
+
def self?.parse_form_data: (_EachLine? io, interned boundary) -> Hash[String, FormData]
|
85
|
+
|
86
|
+
def self?._make_regex: (String str) -> Regexp
|
87
|
+
|
88
|
+
def self?._make_regex!: (String str) -> Regexp
|
89
|
+
|
90
|
+
def self?._escape: (String str, Regexp regex) -> String
|
91
|
+
|
92
|
+
def self?._unescape: (String str, Regexp regex) -> String
|
93
|
+
|
94
|
+
UNESCAPED: Regexp
|
95
|
+
|
96
|
+
UNESCAPED_FORM: Regexp
|
97
|
+
|
98
|
+
NONASCII: Regexp
|
99
|
+
|
100
|
+
ESCAPED: Regexp
|
101
|
+
|
102
|
+
UNESCAPED_PCHAR: Regexp
|
103
|
+
|
104
|
+
def self?.escape: (String str) -> String
|
105
|
+
|
106
|
+
def self?.unescape: (String str) -> String
|
107
|
+
|
108
|
+
def self?.escape_form: (String str) -> String
|
109
|
+
|
110
|
+
def self?.unescape_form: (String str) -> String
|
111
|
+
|
112
|
+
def self?.escape_path: (String str) -> String
|
113
|
+
|
114
|
+
def self?.escape8bit: (String str) -> String
|
115
|
+
end
|
116
|
+
end
|
data/sig/httpversion.rbs
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module WEBrick
|
2
|
+
class HTTPVersion
|
3
|
+
include Comparable
|
4
|
+
|
5
|
+
attr_accessor major: Integer
|
6
|
+
|
7
|
+
attr_accessor minor: Integer
|
8
|
+
|
9
|
+
def self.convert: (HTTPVersion | String version) -> instance
|
10
|
+
|
11
|
+
def initialize: (HTTPVersion | String version) -> void
|
12
|
+
|
13
|
+
def <=>: (HTTPVersion | String other) -> Integer?
|
14
|
+
|
15
|
+
def to_s: () -> String
|
16
|
+
end
|
17
|
+
end
|