webrick 1.9.0 → 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/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/httpauth/authenticator.rbs +1 -1
- data/sig/httprequest.rbs +2 -4
- data/sig/server.rbs +2 -2
- metadata +2 -2
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/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/httprequest.rbs
CHANGED
@@ -8,8 +8,6 @@ module WEBrick
|
|
8
8
|
|
9
9
|
@query: Hash[String, HTTPUtils::FormData]?
|
10
10
|
|
11
|
-
@form_data: nil
|
12
|
-
|
13
11
|
@body: String
|
14
12
|
|
15
13
|
@remaining_size: Integer?
|
@@ -72,9 +70,9 @@ module WEBrick
|
|
72
70
|
|
73
71
|
attr_accessor user: String?
|
74
72
|
|
75
|
-
attr_reader addr: ([String, Integer, String, String] | [])
|
73
|
+
attr_reader addr: ([String, Integer, String, String] | [])
|
76
74
|
|
77
|
-
attr_reader peeraddr: ([String, Integer, String, String] | [])
|
75
|
+
attr_reader peeraddr: ([String, Integer, String, String] | [])
|
78
76
|
|
79
77
|
attr_reader attributes: Hash[untyped, untyped]
|
80
78
|
|
data/sig/server.rbs
CHANGED
@@ -30,7 +30,7 @@ module WEBrick
|
|
30
30
|
|
31
31
|
def listen: (String address, Integer port) -> void
|
32
32
|
|
33
|
-
def start: () { (TCPSocket) -> void } -> void
|
33
|
+
def start: () ?{ (TCPSocket) -> void } -> void
|
34
34
|
|
35
35
|
def stop: () -> void
|
36
36
|
|
@@ -42,7 +42,7 @@ module WEBrick
|
|
42
42
|
|
43
43
|
def accept_client: (TCPServer svr) -> TCPSocket?
|
44
44
|
|
45
|
-
def start_thread: (TCPSocket sock) { (TCPSocket) -> void } -> Thread
|
45
|
+
def start_thread: (TCPSocket sock) ?{ (TCPSocket) -> void } -> Thread
|
46
46
|
|
47
47
|
def call_callback: (Symbol callback_name, *untyped args) -> untyped
|
48
48
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webrick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAKAHASHI Masayoshi
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-12-02 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: WEBrick is an HTTP server toolkit that can be configured as an HTTPS
|
16
16
|
server, a proxy server, and a virtual-host server.
|