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/cookie.rbs
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
module WEBrick
|
2
|
+
class Cookie
|
3
|
+
@expires: String?
|
4
|
+
|
5
|
+
attr_reader name: String?
|
6
|
+
|
7
|
+
attr_accessor value: String?
|
8
|
+
|
9
|
+
attr_accessor version: Integer
|
10
|
+
|
11
|
+
#
|
12
|
+
# The cookie domain
|
13
|
+
attr_accessor domain: String?
|
14
|
+
|
15
|
+
attr_accessor path: String?
|
16
|
+
|
17
|
+
attr_accessor secure: true?
|
18
|
+
|
19
|
+
attr_accessor comment: String?
|
20
|
+
|
21
|
+
attr_accessor max_age: Integer?
|
22
|
+
|
23
|
+
def initialize: (untyped name, untyped value) -> void
|
24
|
+
|
25
|
+
def expires=: ((Time | _ToS)? t) -> untyped
|
26
|
+
|
27
|
+
def expires: () -> Time?
|
28
|
+
|
29
|
+
def to_s: () -> String
|
30
|
+
|
31
|
+
def self.parse: (String? str) -> Array[instance]?
|
32
|
+
|
33
|
+
def self.parse_set_cookie: (String str) -> instance
|
34
|
+
|
35
|
+
def self.parse_set_cookies: (String str) -> Array[instance]
|
36
|
+
end
|
37
|
+
end
|
data/sig/htmlutils.rbs
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPAuth
|
3
|
+
module Authenticator
|
4
|
+
@reload_db: bool?
|
5
|
+
|
6
|
+
@request_field: String
|
7
|
+
|
8
|
+
@response_field: String
|
9
|
+
|
10
|
+
@resp_info_field: String
|
11
|
+
|
12
|
+
@auth_exception: singleton(HTTPStatus::ClientError)
|
13
|
+
|
14
|
+
@auth_scheme: String
|
15
|
+
|
16
|
+
RequestField: String
|
17
|
+
|
18
|
+
ResponseField: String
|
19
|
+
|
20
|
+
ResponseInfoField: String
|
21
|
+
|
22
|
+
AuthException: singleton(HTTPStatus::ClientError)
|
23
|
+
|
24
|
+
AuthScheme: String?
|
25
|
+
|
26
|
+
attr_reader realm: String?
|
27
|
+
|
28
|
+
attr_reader userdb: UserDB
|
29
|
+
|
30
|
+
attr_reader logger: Log
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def check_init: (Hash[Symbol, untyped] config) -> void
|
35
|
+
|
36
|
+
def check_scheme: (HTTPRequest req) -> String?
|
37
|
+
|
38
|
+
def log: (interned meth, String fmt, *untyped args) -> void
|
39
|
+
|
40
|
+
def error: (String fmt, *untyped args) -> void
|
41
|
+
|
42
|
+
def info: (String fmt, *untyped args) -> void
|
43
|
+
end
|
44
|
+
|
45
|
+
module ProxyAuthenticator
|
46
|
+
RequestField: String
|
47
|
+
|
48
|
+
ResponseField: String
|
49
|
+
|
50
|
+
ResponseInfoField: String
|
51
|
+
|
52
|
+
AuthException: singleton(HTTPStatus::ClientError)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPAuth
|
3
|
+
class BasicAuth
|
4
|
+
@config: Hash[Symbol, untyped]
|
5
|
+
|
6
|
+
include Authenticator
|
7
|
+
|
8
|
+
AuthScheme: String
|
9
|
+
|
10
|
+
def self.make_passwd: (String? realm, String? user, String? pass) -> String
|
11
|
+
|
12
|
+
attr_reader realm: String?
|
13
|
+
|
14
|
+
attr_reader userdb: UserDB
|
15
|
+
|
16
|
+
attr_reader logger: Log
|
17
|
+
|
18
|
+
def initialize: (Hash[Symbol, untyped] config, ?Hash[Symbol, untyped] default) -> void
|
19
|
+
|
20
|
+
def authenticate: (HTTPRequest req, HTTPResponse res) -> void
|
21
|
+
|
22
|
+
def challenge: (HTTPRequest req, HTTPResponse res) -> bot
|
23
|
+
end
|
24
|
+
|
25
|
+
class ProxyBasicAuth < BasicAuth
|
26
|
+
include ProxyAuthenticator
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPAuth
|
3
|
+
class DigestAuth
|
4
|
+
@config: Hash[Symbol, untyped]
|
5
|
+
|
6
|
+
@domain: Array[String]?
|
7
|
+
|
8
|
+
@use_opaque: bool
|
9
|
+
|
10
|
+
@use_next_nonce: bool
|
11
|
+
|
12
|
+
@check_nc: bool
|
13
|
+
|
14
|
+
@use_auth_info_header: bool
|
15
|
+
|
16
|
+
@nonce_expire_period: Integer
|
17
|
+
|
18
|
+
@nonce_expire_delta: Integer
|
19
|
+
|
20
|
+
@internet_explorer_hack: bool
|
21
|
+
|
22
|
+
@h: singleton(Digest::Base)
|
23
|
+
|
24
|
+
@instance_key: String
|
25
|
+
|
26
|
+
@opaques: Hash[String, OpaqueInfo]
|
27
|
+
|
28
|
+
@last_nonce_expire: Time
|
29
|
+
|
30
|
+
@mutex: Thread::Mutex
|
31
|
+
|
32
|
+
include Authenticator
|
33
|
+
|
34
|
+
AuthScheme: String
|
35
|
+
|
36
|
+
class OpaqueInfo < Struct[untyped]
|
37
|
+
attr_accessor time(): Time
|
38
|
+
attr_accessor nonce(): String?
|
39
|
+
attr_accessor nc(): String
|
40
|
+
end
|
41
|
+
|
42
|
+
attr_reader algorithm: String?
|
43
|
+
|
44
|
+
attr_reader qop: Array[String]
|
45
|
+
|
46
|
+
def self.make_passwd: (String realm, String user, String pass) -> untyped
|
47
|
+
|
48
|
+
def initialize: (Hash[Symbol, untyped] config, ?Hash[Symbol, untyped] default) -> void
|
49
|
+
|
50
|
+
def authenticate: (HTTPRequest req, HTTPResponse res) -> void
|
51
|
+
|
52
|
+
def challenge: (HTTPRequest req, HTTPResponse res, ?bool stale) -> bot
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
MustParams: Array[String]
|
57
|
+
|
58
|
+
MustParamsAuth: Array[String]
|
59
|
+
|
60
|
+
def _authenticate: (HTTPRequest req, HTTPResponse res) -> (:nonce_is_stale | bool)
|
61
|
+
|
62
|
+
def split_param_value: (String string) -> Hash[String, String]
|
63
|
+
|
64
|
+
def generate_next_nonce: (HTTPRequest req) -> String
|
65
|
+
|
66
|
+
def check_nonce: (HTTPRequest req, Hash[String, String] auth_req) -> bool
|
67
|
+
|
68
|
+
def generate_opaque: (HTTPRequest req) -> String
|
69
|
+
|
70
|
+
def check_opaque: (OpaqueInfo opaque_struct, untyped req, Hash[String, String] auth_req) -> bool
|
71
|
+
|
72
|
+
def check_uri: (HTTPRequest req, Hash[String, String] auth_req) -> bool
|
73
|
+
|
74
|
+
def hexdigest: (*_ToS? args) -> String
|
75
|
+
end
|
76
|
+
|
77
|
+
class ProxyDigestAuth < DigestAuth
|
78
|
+
include ProxyAuthenticator
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def check_uri: (HTTPRequest req, Hash[String, String] auth_req) -> true
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPAuth
|
3
|
+
class Htdigest
|
4
|
+
@path: String
|
5
|
+
|
6
|
+
@mtime: Time
|
7
|
+
|
8
|
+
@digest: Hash[String, Hash[String, String]]
|
9
|
+
|
10
|
+
@mutex: Thread::Mutex
|
11
|
+
|
12
|
+
@auth_type: String
|
13
|
+
|
14
|
+
include UserDB
|
15
|
+
|
16
|
+
def initialize: (String path) -> void
|
17
|
+
|
18
|
+
def reload: () -> void
|
19
|
+
|
20
|
+
def flush: (?String? output) -> void
|
21
|
+
|
22
|
+
def get_passwd: (String realm, String user, bool reload_db) -> String?
|
23
|
+
|
24
|
+
def set_passwd: (String realm, String user, String pass) -> String
|
25
|
+
|
26
|
+
def delete_passwd: (String realm, String user) -> String?
|
27
|
+
|
28
|
+
def each: () { (String user, String realm, String password_hash) -> void } -> void
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPAuth
|
3
|
+
class Htgroup
|
4
|
+
@path: String
|
5
|
+
|
6
|
+
@mtime: Time
|
7
|
+
|
8
|
+
@group: Hash[String, Array[String]]
|
9
|
+
|
10
|
+
def initialize: (String path) -> void
|
11
|
+
|
12
|
+
def reload: () -> void
|
13
|
+
|
14
|
+
def flush: (?String? output) -> void
|
15
|
+
|
16
|
+
def members: (String group) -> Array[String]
|
17
|
+
|
18
|
+
def add: (String group, Array[String] members) -> void
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPAuth
|
3
|
+
class Htpasswd
|
4
|
+
@path: String
|
5
|
+
|
6
|
+
@mtime: Time
|
7
|
+
|
8
|
+
@passwd: Hash[String, String]
|
9
|
+
|
10
|
+
@auth_type: String
|
11
|
+
|
12
|
+
@password_hash: (:crypt | :bcrypt)
|
13
|
+
|
14
|
+
include UserDB
|
15
|
+
|
16
|
+
def initialize: (String path, ?password_hash: (:crypt | :bcrypt)?) -> void
|
17
|
+
|
18
|
+
def reload: () -> void
|
19
|
+
|
20
|
+
def flush: (?String? output) -> void
|
21
|
+
|
22
|
+
def get_passwd: (String realm, String user, bool reload_db) -> String?
|
23
|
+
|
24
|
+
def set_passwd: (String realm, String user, String pass) -> void
|
25
|
+
|
26
|
+
def delete_passwd: (String realm, String user) -> String
|
27
|
+
|
28
|
+
def each: () { ([String, String]) -> void } -> void
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPAuth
|
3
|
+
module UserDB
|
4
|
+
attr_accessor auth_type: String
|
5
|
+
|
6
|
+
def make_passwd: (String realm, String user, String pass) -> String
|
7
|
+
|
8
|
+
def set_passwd: (String realm, String user, String pass) -> void
|
9
|
+
|
10
|
+
def get_passwd: (String realm, String user, ?bool reload_db) -> String
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/sig/httpauth.rbs
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module HTTPAuth
|
3
|
+
interface _Callable
|
4
|
+
def call: (String user, String pass) -> bool
|
5
|
+
end
|
6
|
+
|
7
|
+
def self?._basic_auth: (HTTPRequest req, HTTPResponse res, String realm, String req_field, String res_field, HTTPStatus::Error err_type, _Callable block) -> void
|
8
|
+
|
9
|
+
def self?.basic_auth: (HTTPRequest req, HTTPResponse res, String realm) { (String user, String pass) -> bool } -> void
|
10
|
+
|
11
|
+
def self?.proxy_basic_auth: (HTTPRequest req, HTTPResponse res, String realm) { (String user, String pass) -> bool } -> void
|
12
|
+
end
|
13
|
+
end
|
data/sig/httpproxy.rbs
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
module WEBrick
|
2
|
+
NullReader: untyped
|
3
|
+
|
4
|
+
def self.read: (*untyped args) -> nil
|
5
|
+
|
6
|
+
alias self.gets self.read
|
7
|
+
|
8
|
+
FakeProxyURI: untyped
|
9
|
+
|
10
|
+
def self.method_missing: (untyped meth, *untyped args) -> (nil | untyped)
|
11
|
+
|
12
|
+
class HTTPProxyServer < HTTPServer
|
13
|
+
@via: untyped
|
14
|
+
|
15
|
+
def initialize: (?::Hash[untyped, untyped] config, ?untyped default) -> void
|
16
|
+
|
17
|
+
# :stopdoc:
|
18
|
+
def service: (HTTPRequest req, HTTPResponse res) -> untyped
|
19
|
+
|
20
|
+
def proxy_auth: (HTTPRequest req, HTTPResponse res) -> untyped
|
21
|
+
|
22
|
+
def proxy_uri: (HTTPRequest req, HTTPResponse res) -> untyped
|
23
|
+
|
24
|
+
def proxy_service: (HTTPRequest req, HTTPResponse res) -> untyped
|
25
|
+
|
26
|
+
def do_CONNECT: (HTTPRequest req, HTTPResponse res) -> untyped
|
27
|
+
|
28
|
+
def do_GET: (HTTPRequest req, HTTPResponse res) -> untyped
|
29
|
+
|
30
|
+
def do_HEAD: (HTTPRequest req, HTTPResponse res) -> untyped
|
31
|
+
|
32
|
+
def do_POST: (HTTPRequest req, HTTPResponse res) -> untyped
|
33
|
+
|
34
|
+
def do_OPTIONS: (HTTPRequest req, HTTPResponse res) -> untyped
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# Some header fields should not be transferred.
|
39
|
+
HopByHop: ::Array["connection" | "keep-alive" | "proxy-authenticate" | "upgrade" | "proxy-authorization" | "te" | "trailers" | "transfer-encoding"]
|
40
|
+
|
41
|
+
ShouldNotTransfer: ::Array["set-cookie" | "proxy-connection"]
|
42
|
+
|
43
|
+
def split_field: (untyped f) -> (untyped | ::Array[untyped])
|
44
|
+
|
45
|
+
def choose_header: (untyped src, untyped dst) -> untyped
|
46
|
+
|
47
|
+
# Net::HTTP is stupid about the multiple header fields.
|
48
|
+
# Here is workaround:
|
49
|
+
def set_cookie: (untyped src, untyped dst) -> (untyped | nil)
|
50
|
+
|
51
|
+
def set_via: (untyped h) -> (untyped | nil)
|
52
|
+
|
53
|
+
def setup_proxy_header: (HTTPRequest req, HTTPResponse res) -> untyped
|
54
|
+
|
55
|
+
def setup_upstream_proxy_authentication: (HTTPRequest req, HTTPResponse res, untyped header) -> untyped
|
56
|
+
|
57
|
+
def create_net_http: (untyped uri, untyped upstream) -> untyped
|
58
|
+
|
59
|
+
def perform_proxy_request: (HTTPRequest req, HTTPResponse res, untyped req_class, ?untyped? body_stream) -> untyped
|
60
|
+
end
|
61
|
+
end
|
data/sig/httprequest.rbs
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
module WEBrick
|
2
|
+
class HTTPRequest
|
3
|
+
@config: Hash[Symbol, untyped]
|
4
|
+
|
5
|
+
@buffer_size: Integer
|
6
|
+
|
7
|
+
@logger: Log
|
8
|
+
|
9
|
+
@query: Hash[String, HTTPUtils::FormData]?
|
10
|
+
|
11
|
+
@body: String
|
12
|
+
|
13
|
+
@remaining_size: Integer?
|
14
|
+
|
15
|
+
@socket: TCPSocket?
|
16
|
+
|
17
|
+
@forwarded_proto: String?
|
18
|
+
|
19
|
+
@host: String?
|
20
|
+
|
21
|
+
@port: Integer?
|
22
|
+
|
23
|
+
@body_tmp: Array[String]
|
24
|
+
|
25
|
+
@body_rd: Fiber
|
26
|
+
|
27
|
+
@request_bytes: Integer
|
28
|
+
|
29
|
+
@forwarded_server: String?
|
30
|
+
|
31
|
+
@forwarded_host: String?
|
32
|
+
|
33
|
+
@forwarded_port: Integer?
|
34
|
+
|
35
|
+
@forwarded_for: String?
|
36
|
+
|
37
|
+
BODY_CONTAINABLE_METHODS: Array[String]
|
38
|
+
|
39
|
+
attr_reader request_line: String?
|
40
|
+
|
41
|
+
attr_reader request_method: String?
|
42
|
+
|
43
|
+
attr_reader unparsed_uri: String?
|
44
|
+
|
45
|
+
attr_reader http_version: HTTPVersion?
|
46
|
+
|
47
|
+
attr_reader request_uri: URI::Generic?
|
48
|
+
|
49
|
+
attr_reader path: String?
|
50
|
+
|
51
|
+
attr_accessor script_name: String?
|
52
|
+
|
53
|
+
attr_accessor path_info: String?
|
54
|
+
|
55
|
+
attr_accessor query_string: String?
|
56
|
+
|
57
|
+
attr_reader raw_header: Array[String]
|
58
|
+
|
59
|
+
attr_reader header: Hash[String, Array[String]]?
|
60
|
+
|
61
|
+
attr_reader cookies: Array[Cookie]
|
62
|
+
|
63
|
+
attr_reader accept: Array[String]
|
64
|
+
|
65
|
+
attr_reader accept_charset: Array[String]
|
66
|
+
|
67
|
+
attr_reader accept_encoding: Array[String]
|
68
|
+
|
69
|
+
attr_reader accept_language: Array[String]
|
70
|
+
|
71
|
+
attr_accessor user: String?
|
72
|
+
|
73
|
+
attr_reader addr: ([String, Integer, String, String] | [])
|
74
|
+
|
75
|
+
attr_reader peeraddr: ([String, Integer, String, String] | [])
|
76
|
+
|
77
|
+
attr_reader attributes: Hash[untyped, untyped]
|
78
|
+
|
79
|
+
attr_reader keep_alive: bool
|
80
|
+
|
81
|
+
attr_reader request_time: Time?
|
82
|
+
|
83
|
+
def initialize: (Hash[Symbol, untyped] config) -> void
|
84
|
+
|
85
|
+
def parse: (?TCPSocket? socket) -> void
|
86
|
+
|
87
|
+
def continue: () -> void
|
88
|
+
|
89
|
+
type body_chunk_block = ^(String body_chunk) -> void
|
90
|
+
|
91
|
+
def body: () ?{ (String body_chunk) -> void } -> String
|
92
|
+
|
93
|
+
def body_reader: () -> self
|
94
|
+
|
95
|
+
# for IO.copy_stream.
|
96
|
+
def readpartial: (Integer size, ?String buf) -> String
|
97
|
+
|
98
|
+
def query: () -> Hash[String, HTTPUtils::FormData]
|
99
|
+
|
100
|
+
def content_length: () -> Integer
|
101
|
+
|
102
|
+
def content_type: () -> String?
|
103
|
+
|
104
|
+
def []: (String header_name) -> String?
|
105
|
+
|
106
|
+
def each: [T] () { (String, String) -> T } -> T?
|
107
|
+
|
108
|
+
def host: () -> String?
|
109
|
+
|
110
|
+
def port: () -> Integer?
|
111
|
+
|
112
|
+
def server_name: () -> String?
|
113
|
+
|
114
|
+
def remote_ip: () -> String?
|
115
|
+
|
116
|
+
def ssl?: () -> bool
|
117
|
+
|
118
|
+
def keep_alive?: () -> bool
|
119
|
+
|
120
|
+
def to_s: () -> String
|
121
|
+
|
122
|
+
def fixup: () -> void
|
123
|
+
|
124
|
+
def meta_vars: () -> Hash[String, String]
|
125
|
+
|
126
|
+
private
|
127
|
+
|
128
|
+
MAX_URI_LENGTH: Integer
|
129
|
+
|
130
|
+
# same as Mongrel, Thin and Puma
|
131
|
+
MAX_HEADER_LENGTH: Integer
|
132
|
+
|
133
|
+
def read_request_line: (IO socket) -> void
|
134
|
+
|
135
|
+
def read_header: (IO socket) -> void
|
136
|
+
|
137
|
+
def parse_uri: (String str, ?String scheme) -> URI::Generic
|
138
|
+
|
139
|
+
HOST_PATTERN: Regexp
|
140
|
+
|
141
|
+
def parse_host_request_line: (String host) -> [String, String]
|
142
|
+
|
143
|
+
def read_body: (IO socket, body_chunk_block block) -> String
|
144
|
+
| (nil socket, top block) -> nil
|
145
|
+
|
146
|
+
def read_chunk_size: (IO socket) -> [Integer, String?]
|
147
|
+
|
148
|
+
def read_chunked: (IO socket, body_chunk_block block) -> void
|
149
|
+
|
150
|
+
def _read_data: (IO io, Symbol method, *untyped arg) -> String?
|
151
|
+
|
152
|
+
def read_line: (IO io, ?Integer size) -> String?
|
153
|
+
|
154
|
+
def read_data: (IO io, Integer size) -> String?
|
155
|
+
|
156
|
+
def parse_query: () -> void
|
157
|
+
|
158
|
+
PrivateNetworkRegexp: Regexp
|
159
|
+
|
160
|
+
# It's said that all X-Forwarded-* headers will contain more than one
|
161
|
+
# (comma-separated) value if the original request already contained one of
|
162
|
+
# these headers. Since we could use these values as Host header, we choose
|
163
|
+
# the initial(first) value. (apr_table_mergen() adds new value after the
|
164
|
+
# existing value with ", " prefix)
|
165
|
+
def setup_forwarded_info: () -> void
|
166
|
+
end
|
167
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
module WEBrick
|
2
|
+
class HTTPResponse
|
3
|
+
@buffer_size: Integer
|
4
|
+
|
5
|
+
@logger: Log
|
6
|
+
|
7
|
+
@chunked: bool
|
8
|
+
|
9
|
+
@bodytempfile: File | Tempfile | nil
|
10
|
+
|
11
|
+
class InvalidHeader < StandardError
|
12
|
+
end
|
13
|
+
|
14
|
+
attr_reader http_version: HTTPVersion
|
15
|
+
|
16
|
+
attr_reader status: Integer
|
17
|
+
|
18
|
+
attr_reader header: Hash[String, String]
|
19
|
+
|
20
|
+
attr_reader cookies: Array[Cookie]
|
21
|
+
|
22
|
+
attr_accessor reason_phrase: String
|
23
|
+
|
24
|
+
interface _CallableBody
|
25
|
+
def call: (_Writer) -> void
|
26
|
+
end
|
27
|
+
|
28
|
+
attr_accessor body: String | _ReaderPartial | _CallableBody
|
29
|
+
|
30
|
+
attr_accessor request_method: String?
|
31
|
+
|
32
|
+
attr_accessor request_uri: URI::Generic?
|
33
|
+
|
34
|
+
attr_accessor request_http_version: HTTPVersion?
|
35
|
+
|
36
|
+
attr_accessor filename: String?
|
37
|
+
|
38
|
+
attr_accessor keep_alive: bool
|
39
|
+
|
40
|
+
attr_reader config: Hash[Symbol, untyped]
|
41
|
+
|
42
|
+
attr_reader sent_size: Integer
|
43
|
+
|
44
|
+
attr_accessor upgrade: String?
|
45
|
+
|
46
|
+
def initialize: (Hash[Symbol, untyped] config) -> void
|
47
|
+
|
48
|
+
def status_line: () -> String
|
49
|
+
|
50
|
+
def status=: (Integer status) -> Integer
|
51
|
+
|
52
|
+
def []: (String field) -> String?
|
53
|
+
|
54
|
+
def []=: (String field, _ToS value) -> _ToS
|
55
|
+
|
56
|
+
def content_length: () -> Integer?
|
57
|
+
|
58
|
+
def content_length=: (Integer len) -> Integer
|
59
|
+
|
60
|
+
def content_type: () -> String?
|
61
|
+
|
62
|
+
def content_type=: (String type) -> String
|
63
|
+
|
64
|
+
def each: () { (String, String) -> void } -> void
|
65
|
+
|
66
|
+
def chunked?: () -> bool
|
67
|
+
|
68
|
+
def chunked=: (boolish val) -> boolish
|
69
|
+
|
70
|
+
def keep_alive?: () -> bool
|
71
|
+
|
72
|
+
def upgrade!: (String protocol) -> void
|
73
|
+
|
74
|
+
def send_response: (_Writer socket) -> void
|
75
|
+
|
76
|
+
def setup_header: () -> void
|
77
|
+
|
78
|
+
def make_body_tempfile: () -> void
|
79
|
+
|
80
|
+
def remove_body_tempfile: () -> void
|
81
|
+
|
82
|
+
def send_header: (_Writer socket) -> void
|
83
|
+
|
84
|
+
def send_body: (_Writer socket) -> void
|
85
|
+
|
86
|
+
def set_redirect: (singleton(WEBrick::HTTPStatus::Redirect) status, URI::Generic | String url) -> bot
|
87
|
+
|
88
|
+
def set_error: (singleton(Exception) ex, ?bool backtrace) -> void
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def check_header: (_ToS header_value) -> String
|
93
|
+
|
94
|
+
def error_body: (bool backtrace, singleton(Exception) ex, String? host, Integer? port) -> void
|
95
|
+
|
96
|
+
def send_body_io: (_Writer socket) -> void
|
97
|
+
|
98
|
+
def send_body_string: (_Writer socket) -> void
|
99
|
+
|
100
|
+
def send_body_proc: (_Writer socket) -> void
|
101
|
+
|
102
|
+
class ChunkedWrapper
|
103
|
+
@socket: _Writer
|
104
|
+
|
105
|
+
@resp: HTTPResponse
|
106
|
+
|
107
|
+
def initialize: (_Writer socket, HTTPResponse resp) -> void
|
108
|
+
|
109
|
+
def write: (_ToS buf) -> Integer
|
110
|
+
|
111
|
+
def <<: (*_ToS buf) -> self
|
112
|
+
end
|
113
|
+
|
114
|
+
# preserved for compatibility with some 3rd-party handlers
|
115
|
+
def _write_data: [T] (T socket, _ToS data) -> T
|
116
|
+
end
|
117
|
+
end
|