webrick 1.8.2 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/README.md +2 -0
- 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 +6 -6
- 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 +2 -2
- 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 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d133a0575bc3ed8393d991def2829498130eac921b9485e47d00a6259ec00fe6
|
4
|
+
data.tar.gz: 2e8da0c038c346abc67b325c41408199eb6475ee7fad9a155c67330ca15c5aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5f68a58deca28be7dbde1b557a17a16f9d69c244c567830b89b22c26689db8b28e6a69097e6f47fc3d50d9caea69c691ead0468ef13777081aaf03e0d7c46f2
|
7
|
+
data.tar.gz: b9c35a51cf9d662d2151dd40d79c2cceebe5404fe5e8464cd666eff3127729a7225b728e78f59bfc08ea545b4de1046dad1c08a65e1e2fd402e91a0c53a264e6
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -10,6 +10,8 @@ A WEBrick server can be composed of multiple WEBrick servers or servlets to prov
|
|
10
10
|
|
11
11
|
WEBrick also includes tools for daemonizing a process and starting a process at a higher privilege level and dropping permissions.
|
12
12
|
|
13
|
+
WEBrick is suitable for use in testing and for development. However, while the developers of WEBrick will attempt to fix security issues, they do not encourage the use of WEBrick to serve production web applications that may be subject to hostile input.
|
14
|
+
|
13
15
|
## Installation
|
14
16
|
|
15
17
|
Add this line to your application's Gemfile:
|
data/lib/webrick/cgi.rb
CHANGED
@@ -108,10 +108,10 @@ module WEBrick
|
|
108
108
|
# authentication schemes for proxies.
|
109
109
|
|
110
110
|
module ProxyAuthenticator
|
111
|
-
RequestField
|
112
|
-
ResponseField
|
113
|
-
|
114
|
-
AuthException
|
111
|
+
RequestField = "Proxy-Authorization" # :nodoc:
|
112
|
+
ResponseField = "Proxy-Authenticate" # :nodoc:
|
113
|
+
ResponseInfoField = "Proxy-Authentication-Info" # :nodoc:
|
114
|
+
AuthException = HTTPStatus::ProxyAuthenticationRequired # :nodoc:
|
115
115
|
end
|
116
116
|
end
|
117
117
|
end
|
@@ -77,12 +77,12 @@ module WEBrick
|
|
77
77
|
if @password_hash == :bcrypt
|
78
78
|
raise StandardError, ".htpasswd file contains crypt password, only bcrypt passwords supported"
|
79
79
|
end
|
80
|
-
user, pass = line.split(":")
|
80
|
+
user, pass = line.split(":", 2)
|
81
81
|
when %r!\A[^:]+:\$2[aby]\$\d{2}\$.{53}\z!
|
82
82
|
if @password_hash == :crypt
|
83
83
|
raise StandardError, ".htpasswd file contains bcrypt password, only crypt passwords supported"
|
84
84
|
end
|
85
|
-
user, pass = line.split(":")
|
85
|
+
user, pass = line.split(":", 2)
|
86
86
|
when /:\$/, /:{SHA}/
|
87
87
|
raise NotImplementedError,
|
88
88
|
'MD5, SHA1 .htpasswd file not supported'
|
data/lib/webrick/httpproxy.rb
CHANGED
@@ -118,7 +118,7 @@ module WEBrick
|
|
118
118
|
public_send("do_#{req.request_method}", req, res)
|
119
119
|
rescue NoMethodError
|
120
120
|
raise HTTPStatus::MethodNotAllowed,
|
121
|
-
"unsupported method
|
121
|
+
"unsupported method '#{req.request_method}'."
|
122
122
|
rescue => err
|
123
123
|
logger.debug("#{err.class}: #{err.message}")
|
124
124
|
raise HTTPStatus::ServiceUnavailable, err.message
|
@@ -149,7 +149,7 @@ module WEBrick
|
|
149
149
|
end
|
150
150
|
|
151
151
|
begin
|
152
|
-
@logger.debug("CONNECT: upstream proxy is
|
152
|
+
@logger.debug("CONNECT: upstream proxy is '#{host}:#{port}'.")
|
153
153
|
os = TCPSocket.new(host, port) # origin server
|
154
154
|
|
155
155
|
if proxy
|
@@ -175,7 +175,7 @@ module WEBrick
|
|
175
175
|
@logger.debug("CONNECT #{host}:#{port}: succeeded")
|
176
176
|
res.status = HTTPStatus::RC_OK
|
177
177
|
rescue => ex
|
178
|
-
@logger.debug("CONNECT #{host}:#{port}: failed
|
178
|
+
@logger.debug("CONNECT #{host}:#{port}: failed '#{ex.message}'")
|
179
179
|
res.set_error(ex)
|
180
180
|
raise HTTPStatus::EOFError
|
181
181
|
ensure
|
@@ -241,7 +241,7 @@ module WEBrick
|
|
241
241
|
if HopByHop.member?(key) || # RFC2616: 13.5.1
|
242
242
|
connections.member?(key) || # RFC2616: 14.10
|
243
243
|
ShouldNotTransfer.member?(key) # pragmatics
|
244
|
-
@logger.debug("choose_header:
|
244
|
+
@logger.debug("choose_header: '#{key}: #{value}'")
|
245
245
|
next
|
246
246
|
end
|
247
247
|
dst[key] = value
|
data/lib/webrick/httprequest.rb
CHANGED
@@ -162,7 +162,6 @@ module WEBrick
|
|
162
162
|
@script_name = @path_info = nil
|
163
163
|
@query_string = nil
|
164
164
|
@query = nil
|
165
|
-
@form_data = nil
|
166
165
|
|
167
166
|
@raw_header = Array.new
|
168
167
|
@header = nil
|
@@ -173,7 +172,8 @@ module WEBrick
|
|
173
172
|
@accept_language = []
|
174
173
|
@body = +""
|
175
174
|
|
176
|
-
@addr =
|
175
|
+
@addr = []
|
176
|
+
@peeraddr = []
|
177
177
|
@attributes = {}
|
178
178
|
@user = nil
|
179
179
|
@keep_alive = false
|
@@ -224,7 +224,7 @@ module WEBrick
|
|
224
224
|
@script_name = ""
|
225
225
|
@path_info = @path.dup
|
226
226
|
rescue
|
227
|
-
raise HTTPStatus::BadRequest, "bad URI
|
227
|
+
raise HTTPStatus::BadRequest, "bad URI '#{@unparsed_uri}'."
|
228
228
|
end
|
229
229
|
|
230
230
|
if /\Aclose\z/io =~ self["connection"]
|
@@ -464,7 +464,7 @@ module WEBrick
|
|
464
464
|
@http_version = HTTPVersion.new($3 ? $3 : "0.9")
|
465
465
|
else
|
466
466
|
rl = @request_line.sub(/\x0d?\x0a\z/o, '')
|
467
|
-
raise HTTPStatus::BadRequest, "bad Request-Line
|
467
|
+
raise HTTPStatus::BadRequest, "bad Request-Line '#{rl}'."
|
468
468
|
end
|
469
469
|
end
|
470
470
|
|
@@ -563,7 +563,7 @@ module WEBrick
|
|
563
563
|
chunk_ext = $2
|
564
564
|
[ chunk_size, chunk_ext ]
|
565
565
|
else
|
566
|
-
raise HTTPStatus::BadRequest, "bad chunk
|
566
|
+
raise HTTPStatus::BadRequest, "bad chunk '#{line}'."
|
567
567
|
end
|
568
568
|
end
|
569
569
|
|
@@ -581,7 +581,7 @@ module WEBrick
|
|
581
581
|
|
582
582
|
line = read_line(socket) # skip CRLF
|
583
583
|
unless line == "\r\n"
|
584
|
-
raise HTTPStatus::BadRequest, "extra data after chunk
|
584
|
+
raise HTTPStatus::BadRequest, "extra data after chunk '#{line}'."
|
585
585
|
end
|
586
586
|
|
587
587
|
chunk_size, = read_chunk_size(socket)
|
data/lib/webrick/httpresponse.rb
CHANGED
@@ -453,7 +453,7 @@ module WEBrick
|
|
453
453
|
_end_of_html_
|
454
454
|
|
455
455
|
if backtrace && $DEBUG
|
456
|
-
@body << "backtrace of
|
456
|
+
@body << "backtrace of '#{HTMLUtils::escape(ex.class.to_s)}' "
|
457
457
|
@body << "#{HTMLUtils::escape(ex.message)}"
|
458
458
|
@body << "<PRE>"
|
459
459
|
ex.backtrace.each{|line| @body << "\t#{line}\n"}
|
data/lib/webrick/httpserver.rb
CHANGED
@@ -128,11 +128,11 @@ module WEBrick
|
|
128
128
|
do_OPTIONS(req, res)
|
129
129
|
raise HTTPStatus::OK
|
130
130
|
end
|
131
|
-
raise HTTPStatus::NotFound, "
|
131
|
+
raise HTTPStatus::NotFound, "'#{req.unparsed_uri}' not found."
|
132
132
|
end
|
133
133
|
|
134
134
|
servlet, options, script_name, path_info = search_servlet(req.path)
|
135
|
-
raise HTTPStatus::NotFound, "
|
135
|
+
raise HTTPStatus::NotFound, "'#{req.path}' not found." unless servlet
|
136
136
|
req.script_name = script_name
|
137
137
|
req.path_info = path_info
|
138
138
|
si = servlet.get_instance(self, *options)
|
@@ -250,7 +250,7 @@ module WEBrick
|
|
250
250
|
|
251
251
|
def do_POST(req, res)
|
252
252
|
unless exec_handler(req, res)
|
253
|
-
raise HTTPStatus::NotFound, "
|
253
|
+
raise HTTPStatus::NotFound, "'#{req.path}' not found."
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
@@ -307,7 +307,7 @@ module WEBrick
|
|
307
307
|
end
|
308
308
|
|
309
309
|
def exec_handler(req, res)
|
310
|
-
raise HTTPStatus::NotFound, "
|
310
|
+
raise HTTPStatus::NotFound, "'#{req.path}' not found." unless @root
|
311
311
|
if set_filename(req, res)
|
312
312
|
handler = get_handler(req, res)
|
313
313
|
call_callback(:HandlerCallback, req, res)
|
@@ -359,7 +359,7 @@ module WEBrick
|
|
359
359
|
call_callback(:FileCallback, req, res)
|
360
360
|
return true
|
361
361
|
else
|
362
|
-
raise HTTPStatus::NotFound, "
|
362
|
+
raise HTTPStatus::NotFound, "'#{req.path}' not found."
|
363
363
|
end
|
364
364
|
end
|
365
365
|
|
@@ -368,8 +368,8 @@ module WEBrick
|
|
368
368
|
|
369
369
|
def check_filename(req, res, name)
|
370
370
|
if nondisclosure_name?(name) || windows_ambiguous_name?(name)
|
371
|
-
@logger.warn("the request refers nondisclosure name
|
372
|
-
raise HTTPStatus::NotFound, "
|
371
|
+
@logger.warn("the request refers nondisclosure name '#{name}'.")
|
372
|
+
raise HTTPStatus::NotFound, "'#{req.path}' not found."
|
373
373
|
end
|
374
374
|
end
|
375
375
|
|
@@ -437,7 +437,7 @@ module WEBrick
|
|
437
437
|
def set_dir_list(req, res)
|
438
438
|
redirect_to_directory_uri(req, res)
|
439
439
|
unless @options[:FancyIndexing]
|
440
|
-
raise HTTPStatus::Forbidden, "no access permission to
|
440
|
+
raise HTTPStatus::Forbidden, "no access permission to '#{req.path}'"
|
441
441
|
end
|
442
442
|
local_path = res.filename
|
443
443
|
list = Dir::entries(local_path).collect{|name|
|
data/lib/webrick/httputils.rb
CHANGED
@@ -29,14 +29,14 @@ module WEBrick
|
|
29
29
|
# normalized.
|
30
30
|
|
31
31
|
def normalize_path(path)
|
32
|
-
raise "abnormal path
|
32
|
+
raise "abnormal path '#{path}'" if path[0] != ?/
|
33
33
|
ret = path.dup
|
34
34
|
|
35
35
|
ret.gsub!(%r{/+}o, '/') # // => /
|
36
36
|
while ret.sub!(%r'/\.(?:/|\Z)', '/'); end # /. => /
|
37
37
|
while ret.sub!(%r'/(?!\.\./)[^/]+/\.\.(?:/|\Z)', '/'); end # /foo/.. => /foo
|
38
38
|
|
39
|
-
raise "abnormal path
|
39
|
+
raise "abnormal path '#{path}'" if %r{/\.\.(/|\Z)} =~ ret
|
40
40
|
ret
|
41
41
|
end
|
42
42
|
module_function :normalize_path
|
data/lib/webrick/server.rb
CHANGED
@@ -365,7 +365,7 @@ module WEBrick
|
|
365
365
|
begin
|
366
366
|
s.shutdown
|
367
367
|
rescue Errno::ENOTCONN
|
368
|
-
# when
|
368
|
+
# when 'Errno::ENOTCONN: Socket is not connected' on some platforms,
|
369
369
|
# call #close instead of #shutdown.
|
370
370
|
# (ignore @config[:ShutdownSocketWithoutClose])
|
371
371
|
s.close
|
data/lib/webrick/version.rb
CHANGED
data/sig/accesslog.rbs
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module AccessLog
|
3
|
+
class AccessLogError < StandardError
|
4
|
+
end
|
5
|
+
|
6
|
+
CLF_TIME_FORMAT: String
|
7
|
+
|
8
|
+
COMMON_LOG_FORMAT: String
|
9
|
+
|
10
|
+
CLF: String
|
11
|
+
|
12
|
+
REFERER_LOG_FORMAT: String
|
13
|
+
|
14
|
+
AGENT_LOG_FORMAT: String
|
15
|
+
|
16
|
+
COMBINED_LOG_FORMAT: String
|
17
|
+
|
18
|
+
def self?.setup_params: (Hash[Symbol, untyped] config, HTTPRequest req, HTTPResponse res) -> Hash[String, untyped]
|
19
|
+
|
20
|
+
def self?.format: (String format_string, Hash[String, untyped] params) -> String
|
21
|
+
|
22
|
+
def self?.escape: (String data) -> String
|
23
|
+
end
|
24
|
+
end
|
data/sig/cgi.rbs
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
module WEBrick
|
2
|
+
class CGI
|
3
|
+
@options: Array[untyped]
|
4
|
+
|
5
|
+
class CGIError < StandardError
|
6
|
+
end
|
7
|
+
|
8
|
+
attr_reader config: Hash[Symbol, untyped]
|
9
|
+
|
10
|
+
attr_reader logger: BasicLog
|
11
|
+
|
12
|
+
def initialize: (*untyped args) -> void
|
13
|
+
|
14
|
+
def []: (Symbol key) -> untyped
|
15
|
+
|
16
|
+
interface _Env
|
17
|
+
def []: (String) -> String?
|
18
|
+
end
|
19
|
+
|
20
|
+
def start: (?_Env env, ?IO stdin, ?IO stdout) -> void
|
21
|
+
|
22
|
+
def self.setup_header: () -> untyped
|
23
|
+
|
24
|
+
def self.status_line: () -> ""
|
25
|
+
|
26
|
+
def service: (HTTPRequest req, HTTPResponse res) -> void
|
27
|
+
|
28
|
+
class Socket
|
29
|
+
@config: Hash[Symbol, untyped]
|
30
|
+
|
31
|
+
@env: _Env
|
32
|
+
|
33
|
+
@header_part: StringIO
|
34
|
+
|
35
|
+
@body_part: IO
|
36
|
+
|
37
|
+
@out_port: IO
|
38
|
+
|
39
|
+
@server_addr: String
|
40
|
+
|
41
|
+
@server_name: String?
|
42
|
+
|
43
|
+
@server_port: String?
|
44
|
+
|
45
|
+
@remote_addr: String?
|
46
|
+
|
47
|
+
@remote_host: String?
|
48
|
+
|
49
|
+
@remote_port: (String | 0)
|
50
|
+
|
51
|
+
include Enumerable[String]
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def initialize: (Hash[Symbol, untyped] config, _Env env, IO stdin, IO stdout) -> void
|
56
|
+
|
57
|
+
def request_line: () -> String
|
58
|
+
|
59
|
+
def setup_header: () -> void
|
60
|
+
|
61
|
+
def add_header: (String hdrname, String value) -> void
|
62
|
+
|
63
|
+
def input: () -> (IO | StringIO)
|
64
|
+
|
65
|
+
public
|
66
|
+
|
67
|
+
def peeraddr: () -> [nil, (String | 0), String?, String?]
|
68
|
+
|
69
|
+
def addr: () -> [nil, String?, String?, String]
|
70
|
+
|
71
|
+
def gets: (?String eol, ?Integer? size) -> String?
|
72
|
+
|
73
|
+
def read: (?Integer? size) -> String?
|
74
|
+
|
75
|
+
def each: () { (String) -> void } -> void
|
76
|
+
|
77
|
+
def eof?: () -> bool
|
78
|
+
|
79
|
+
def <<: (_ToS data) -> IO
|
80
|
+
|
81
|
+
def write: (_ToS data) -> Integer
|
82
|
+
|
83
|
+
def cert: () -> OpenSSL::X509::Certificate?
|
84
|
+
|
85
|
+
def peer_cert: () -> OpenSSL::X509::Certificate?
|
86
|
+
|
87
|
+
def peer_cert_chain: () -> Array[OpenSSL::X509::Certificate]?
|
88
|
+
|
89
|
+
def cipher: () -> [String?, String?, String?, String?]?
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
data/sig/compat.rbs
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# System call error module used by webrick for cross platform compatibility.
|
3
|
+
#
|
4
|
+
# EPROTO:: protocol error
|
5
|
+
# ECONNRESET:: remote host reset the connection request
|
6
|
+
# ECONNABORTED:: Client sent TCP reset (RST) before server has accepted the
|
7
|
+
# connection requested by client.
|
8
|
+
#
|
9
|
+
module Errno
|
10
|
+
class EPROTO < SystemCallError
|
11
|
+
end
|
12
|
+
|
13
|
+
class ECONNRESET < SystemCallError
|
14
|
+
end
|
15
|
+
|
16
|
+
class ECONNABORTED < SystemCallError
|
17
|
+
end
|
18
|
+
end
|
data/sig/config.rbs
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module WEBrick
|
2
|
+
module Config
|
3
|
+
LIBDIR: String
|
4
|
+
|
5
|
+
# for GenericServer
|
6
|
+
General: Hash[Symbol, untyped]
|
7
|
+
|
8
|
+
# for HTTPServer, HTTPRequest, HTTPResponse ...
|
9
|
+
HTTP: Hash[Symbol, untyped]
|
10
|
+
|
11
|
+
FileHandler: Hash[Symbol, untyped]
|
12
|
+
|
13
|
+
BasicAuth: Hash[Symbol, untyped]
|
14
|
+
|
15
|
+
DigestAuth: Hash[Symbol, untyped]
|
16
|
+
end
|
17
|
+
end
|
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
|