webrick 1.9.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 706b97607998e5b9d2a966fd09af6f7fa6a5b40f2df22977b111e5afa2bbc0f6
4
- data.tar.gz: e4376566540a86f896f31b61ed924d69f0fb415fe491273b0365169c16663ef7
3
+ metadata.gz: d133a0575bc3ed8393d991def2829498130eac921b9485e47d00a6259ec00fe6
4
+ data.tar.gz: 2e8da0c038c346abc67b325c41408199eb6475ee7fad9a155c67330ca15c5aed
5
5
  SHA512:
6
- metadata.gz: d4321cb073b84fc0e32211b4fa1510520ec396a62b3165761638e84471a1e56915f751d46aceae6ac8d13aafd09b9066a05928a5b76abf3c82bc8501e74a9029
7
- data.tar.gz: 9f66a53d89839da69abb3afd75a48f746e4023f888db3afd404a903bebde1f878318f08dff470e3006e1fa0637185f9f5bdc9e59c627f162e3664a482b149d06
6
+ metadata.gz: c5f68a58deca28be7dbde1b557a17a16f9d69c244c567830b89b22c26689db8b28e6a69097e6f47fc3d50d9caea69c691ead0468ef13777081aaf03e0d7c46f2
7
+ data.tar.gz: b9c35a51cf9d662d2151dd40d79c2cceebe5404fe5e8464cd666eff3127729a7225b728e78f59bfc08ea545b4de1046dad1c08a65e1e2fd402e91a0c53a264e6
data/lib/webrick/cgi.rb CHANGED
@@ -160,7 +160,7 @@ module WEBrick
160
160
  __send__(method_name, req, res)
161
161
  else
162
162
  raise HTTPStatus::MethodNotAllowed,
163
- "unsupported method `#{req.request_method}'."
163
+ "unsupported method '#{req.request_method}'."
164
164
  end
165
165
  end
166
166
 
@@ -108,10 +108,10 @@ module WEBrick
108
108
  # authentication schemes for proxies.
109
109
 
110
110
  module ProxyAuthenticator
111
- RequestField = "Proxy-Authorization" # :nodoc:
112
- ResponseField = "Proxy-Authenticate" # :nodoc:
113
- InfoField = "Proxy-Authentication-Info" # :nodoc:
114
- AuthException = HTTPStatus::ProxyAuthenticationRequired # :nodoc:
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
@@ -49,7 +49,7 @@ module WEBrick
49
49
  File.open(@path){|io|
50
50
  while line = io.gets
51
51
  line.chomp!
52
- group, members = line.split(/:\s*/)
52
+ group, members = line.split(/:\s*/, 2)
53
53
  @group[group] = members.split(/\s+/)
54
54
  end
55
55
  }
@@ -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'
@@ -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 `#{req.request_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 `#{host}:#{port}'.")
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 `#{ex.message}'")
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: `#{key}: #{value}'")
244
+ @logger.debug("choose_header: '#{key}: #{value}'")
245
245
  next
246
246
  end
247
247
  dst[key] = value
@@ -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 = @peeraddr = nil
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 `#{@unparsed_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 `#{rl}'."
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 `#{line}'."
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 `#{line}'."
584
+ raise HTTPStatus::BadRequest, "extra data after chunk '#{line}'."
585
585
  end
586
586
 
587
587
  chunk_size, = read_chunk_size(socket)
@@ -453,7 +453,7 @@ module WEBrick
453
453
  _end_of_html_
454
454
 
455
455
  if backtrace && $DEBUG
456
- @body << "backtrace of `#{HTMLUtils::escape(ex.class.to_s)}' "
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"}
@@ -128,11 +128,11 @@ module WEBrick
128
128
  do_OPTIONS(req, res)
129
129
  raise HTTPStatus::OK
130
130
  end
131
- raise HTTPStatus::NotFound, "`#{req.unparsed_uri}' not found."
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, "`#{req.path}' not found." unless servlet
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)
@@ -105,7 +105,7 @@ module WEBrick
105
105
  __send__(method_name, req, res)
106
106
  else
107
107
  raise HTTPStatus::MethodNotAllowed,
108
- "unsupported method `#{req.request_method}'."
108
+ "unsupported method '#{req.request_method}'."
109
109
  end
110
110
  end
111
111
 
@@ -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, "`#{req.path}' not found."
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, "`#{req.path}' not found." unless @root
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, "`#{req.path}' not found."
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 `#{name}'.")
372
- raise HTTPStatus::NotFound, "`#{req.path}' not found."
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 `#{req.path}'"
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|
@@ -29,14 +29,14 @@ module WEBrick
29
29
  # normalized.
30
30
 
31
31
  def normalize_path(path)
32
- raise "abnormal path `#{path}'" if path[0] != ?/
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 `#{path}'" if %r{/\.\.(/|\Z)} =~ ret
39
+ raise "abnormal path '#{path}'" if %r{/\.\.(/|\Z)} =~ ret
40
40
  ret
41
41
  end
42
42
  module_function :normalize_path
@@ -365,7 +365,7 @@ module WEBrick
365
365
  begin
366
366
  s.shutdown
367
367
  rescue Errno::ENOTCONN
368
- # when `Errno::ENOTCONN: Socket is not connected' on some platforms,
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
@@ -14,5 +14,5 @@ module WEBrick
14
14
  ##
15
15
  # The WEBrick version
16
16
 
17
- VERSION = "1.9.0"
17
+ VERSION = "1.9.1"
18
18
  end
@@ -47,7 +47,7 @@ module WEBrick
47
47
 
48
48
  ResponseField: String
49
49
 
50
- InfoField: String
50
+ ResponseInfoField: String
51
51
 
52
52
  AuthException: singleton(HTTPStatus::ClientError)
53
53
  end
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.0
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-11-01 00:00:00.000000000 Z
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.