brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2023-01-27 18:08:11 +00:00
parent ab69719957
commit f9facbf2b6
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
36 changed files with 127 additions and 83 deletions

View File

@ -69,7 +69,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/racc-1.6.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/racc-1.6.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/nokogiri-1.13.10-x86_64-darwin/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/nokogiri-1.13.10-x86_64-darwin/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubyntlm-0.6.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/rubyntlm-0.6.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrick-1.7.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrick-1.8.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrobots-0.1.2/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/webrobots-0.1.2/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mechanize-2.8.5/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/mechanize-2.8.5/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/method_source-1.0.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/method_source-1.0.0/lib")
@ -119,7 +119,7 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.10461/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/sorbet-static-and-runtime-0.5.10461/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.2.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/thor-1.2.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.1.11/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/spoom-1.1.11/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.28/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-0.9.26/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.6.1/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/yard-sorbet-0.6.1/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.7.3/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/tapioca-0.7.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.3.0/lib") $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/warning-1.3.0/lib")

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
#-- #--
# accesslog.rb -- Access log handling utilities # accesslog.rb -- Access log handling utilities
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# cgi.rb -- Yet another CGI library # cgi.rb -- Yet another CGI library
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# compat.rb -- cross platform compatibility # compat.rb -- cross platform compatibility
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# config.rb -- Default configurations. # config.rb -- Default configurations.
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# cookie.rb -- Cookie class # cookie.rb -- Cookie class
# #
@ -92,7 +92,7 @@ module WEBrick
# The cookie string suitable for use in an HTTP header # The cookie string suitable for use in an HTTP header
def to_s def to_s
ret = "" ret = +""
ret << @name << "=" << @value ret << @name << "=" << @value
ret << "; " << "Version=" << @version.to_s if @version > 0 ret << "; " << "Version=" << @version.to_s if @version > 0
ret << "; " << "Domain=" << @domain if @domain ret << "; " << "Domain=" << @domain if @domain

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
#-- #--
# htmlutils.rb -- HTMLUtils Module # htmlutils.rb -- HTMLUtils Module
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpauth.rb -- HTTP access authentication # httpauth.rb -- HTTP access authentication
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
#-- #--
# httpauth/authenticator.rb -- Authenticator mix-in module. # httpauth/authenticator.rb -- Authenticator mix-in module.
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpauth/basicauth.rb -- HTTP basic access authentication # httpauth/basicauth.rb -- HTTP basic access authentication
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpauth/digestauth.rb -- HTTP digest access authentication # httpauth/digestauth.rb -- HTTP digest access authentication
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpauth/htdigest.rb -- Apache compatible htdigest file # httpauth/htdigest.rb -- Apache compatible htdigest file
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpauth/htgroup.rb -- Apache compatible htgroup file # httpauth/htgroup.rb -- Apache compatible htgroup file
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpauth/htpasswd -- Apache compatible htpasswd file # httpauth/htpasswd -- Apache compatible htpasswd file
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
#-- #--
# httpauth/userdb.rb -- UserDB mix-in module. # httpauth/userdb.rb -- UserDB mix-in module.
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpproxy.rb -- HTTPProxy Class # httpproxy.rb -- HTTPProxy Class
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httprequest.rb -- HTTPRequest Class # httprequest.rb -- HTTPRequest Class
# #
@ -171,7 +171,7 @@ module WEBrick
@accept_charset = [] @accept_charset = []
@accept_encoding = [] @accept_encoding = []
@accept_language = [] @accept_language = []
@body = "" @body = +""
@addr = @peeraddr = nil @addr = @peeraddr = nil
@attributes = {} @attributes = {}
@ -491,8 +491,7 @@ module WEBrick
if @forwarded_host if @forwarded_host
host, port = @forwarded_host, @forwarded_port host, port = @forwarded_host, @forwarded_port
elsif self["host"] elsif self["host"]
pattern = /\A(#{URI::REGEXP::PATTERN::HOST})(?::(\d+))?\z/n host, port = parse_host_request_line(self["host"])
host, port = *self['host'].scan(pattern)[0]
elsif @addr.size > 0 elsif @addr.size > 0
host, port = @addr[2], @addr[1] host, port = @addr[2], @addr[1]
else else
@ -504,6 +503,11 @@ module WEBrick
return URI::parse(uri.to_s) return URI::parse(uri.to_s)
end end
def parse_host_request_line(host)
pattern = /\A(#{URI::REGEXP::PATTERN::HOST})(?::(\d+))?\z/no
host.scan(pattern)[0]
end
def read_body(socket, block) def read_body(socket, block)
return unless socket return unless socket
if tc = self['transfer-encoding'] if tc = self['transfer-encoding']
@ -522,7 +526,7 @@ module WEBrick
if @remaining_size > 0 && @socket.eof? if @remaining_size > 0 && @socket.eof?
raise HTTPStatus::BadRequest, "invalid body size." raise HTTPStatus::BadRequest, "invalid body size."
end end
elsif BODY_CONTAINABLE_METHODS.member?(@request_method) && !@socket.eof elsif BODY_CONTAINABLE_METHODS.member?(@request_method)
raise HTTPStatus::LengthRequired raise HTTPStatus::LengthRequired
end end
return @body return @body

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpresponse.rb -- HTTPResponse Class # httpresponse.rb -- HTTPResponse Class
# #
@ -105,6 +105,11 @@ module WEBrick
attr_reader :sent_size attr_reader :sent_size
##
# Set the response body proc as an streaming/upgrade response.
attr_accessor :upgrade
## ##
# Creates a new HTTP response object. WEBrick::Config::HTTP is the # Creates a new HTTP response object. WEBrick::Config::HTTP is the
# default configuration. # default configuration.
@ -117,7 +122,7 @@ module WEBrick
@status = HTTPStatus::RC_OK @status = HTTPStatus::RC_OK
@reason_phrase = nil @reason_phrase = nil
@http_version = HTTPVersion::convert(@config[:HTTPVersion]) @http_version = HTTPVersion::convert(@config[:HTTPVersion])
@body = '' @body = +""
@keep_alive = true @keep_alive = true
@cookies = [] @cookies = []
@request_method = nil @request_method = nil
@ -217,6 +222,16 @@ module WEBrick
@keep_alive @keep_alive
end end
##
# Sets the response to be a streaming/upgrade response.
# This will disable keep-alive and chunked transfer encoding.
def upgrade!(protocol)
@upgrade = protocol
@keep_alive = false
@chunked = false
end
## ##
# Sends the response on +socket+ # Sends the response on +socket+
@ -242,6 +257,14 @@ module WEBrick
@header['server'] ||= @config[:ServerSoftware] @header['server'] ||= @config[:ServerSoftware]
@header['date'] ||= Time.now.httpdate @header['date'] ||= Time.now.httpdate
if @upgrade
@header['connection'] = 'upgrade'
@header['upgrade'] = @upgrade
@keep_alive = false
return
end
# HTTP/0.9 features # HTTP/0.9 features
if @request_http_version < "1.0" if @request_http_version < "1.0"
@http_version = HTTPVersion.new("0.9") @http_version = HTTPVersion.new("0.9")
@ -268,11 +291,10 @@ module WEBrick
elsif %r{^multipart/byteranges} =~ @header['content-type'] elsif %r{^multipart/byteranges} =~ @header['content-type']
@header.delete('content-length') @header.delete('content-length')
elsif @header['content-length'].nil? elsif @header['content-length'].nil?
if @body.respond_to? :readpartial if @body.respond_to?(:bytesize)
elsif @body.respond_to? :call @header['content-length'] = @body.bytesize.to_s
make_body_tempfile
else else
@header['content-length'] = (@body ? @body.bytesize : 0).to_s @header['connection'] = 'close'
end end
end end
@ -332,7 +354,7 @@ module WEBrick
def send_header(socket) # :nodoc: def send_header(socket) # :nodoc:
if @http_version.major > 0 if @http_version.major > 0
data = status_line() data = status_line().dup
@header.each{|key, value| @header.each{|key, value|
tmp = key.gsub(/\bwww|^te$|\b\w/){ $&.upcase } tmp = key.gsub(/\bwww|^te$|\b\w/){ $&.upcase }
data << "#{tmp}: #{check_header(value)}" << CRLF data << "#{tmp}: #{check_header(value)}" << CRLF
@ -419,7 +441,7 @@ module WEBrick
# :stopdoc: # :stopdoc:
def error_body(backtrace, ex, host, port) def error_body(backtrace, ex, host, port)
@body = '' @body = +""
@body << <<-_end_of_html_ @body << <<-_end_of_html_
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<HTML> <HTML>
@ -453,11 +475,11 @@ module WEBrick
if @request_method == "HEAD" if @request_method == "HEAD"
# do nothing # do nothing
elsif chunked? elsif chunked?
buf = '' buf = +''
begin begin
@body.readpartial(@buffer_size, buf) @body.readpartial(@buffer_size, buf)
size = buf.bytesize size = buf.bytesize
data = "#{size.to_s(16)}#{CRLF}#{buf}#{CRLF}" data = +"#{size.to_s(16)}#{CRLF}#{buf}#{CRLF}"
socket.write(data) socket.write(data)
data.clear data.clear
@sent_size += size @sent_size += size
@ -517,14 +539,16 @@ module WEBrick
@body.call(ChunkedWrapper.new(socket, self)) @body.call(ChunkedWrapper.new(socket, self))
socket.write("0#{CRLF}#{CRLF}") socket.write("0#{CRLF}#{CRLF}")
else else
size = @header['content-length'].to_i
if @bodytempfile if @bodytempfile
@bodytempfile.rewind @bodytempfile.rewind
IO.copy_stream(@bodytempfile, socket) IO.copy_stream(@bodytempfile, socket)
else else
@body.call(socket) @body.call(socket)
end end
@sent_size = size
if content_length = @header['content-length']
@sent_size = content_length.to_i
end
end end
end end
@ -539,7 +563,7 @@ module WEBrick
socket = @socket socket = @socket
@resp.instance_eval { @resp.instance_eval {
size = buf.bytesize size = buf.bytesize
data = "#{size.to_s(16)}#{CRLF}#{buf}#{CRLF}" data = +"#{size.to_s(16)}#{CRLF}#{buf}#{CRLF}"
socket.write(data) socket.write(data)
data.clear data.clear
@sent_size += size @sent_size += size

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# https.rb -- SSL/TLS enhancement for HTTPServer # https.rb -- SSL/TLS enhancement for HTTPServer
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpserver.rb -- HTTPServer Class # httpserver.rb -- HTTPServer Class
# #
@ -285,7 +285,7 @@ module WEBrick
end end
def normalize(dir) def normalize(dir)
ret = dir ? dir.dup : "" ret = dir ? dir.dup : +""
ret.sub!(%r|/+\z|, "") ret.sub!(%r|/+\z|, "")
ret ret
end end

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpservlet.rb -- HTTPServlet Utility File # httpservlet.rb -- HTTPServlet Utility File
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httpservlet.rb -- HTTPServlet Module # httpservlet.rb -- HTTPServlet Module
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# cgi_runner.rb -- CGI launcher. # cgi_runner.rb -- CGI launcher.
# #
@ -10,7 +10,7 @@
# $IPR: cgi_runner.rb,v 1.9 2002/09/25 11:33:15 gotoyuzo Exp $ # $IPR: cgi_runner.rb,v 1.9 2002/09/25 11:33:15 gotoyuzo Exp $
def sysread(io, size) def sysread(io, size)
buf = "" buf = +""
while size > 0 while size > 0
tmp = io.sysread(size) tmp = io.sysread(size)
buf << tmp buf << tmp

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# cgihandler.rb -- CGIHandler Class # cgihandler.rb -- CGIHandler Class
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# erbhandler.rb -- ERBHandler Class # erbhandler.rb -- ERBHandler Class
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# filehandler.rb -- FileHandler Module # filehandler.rb -- FileHandler Module
# #
@ -481,9 +481,9 @@ module WEBrick
elsif !namewidth or (namewidth = namewidth.to_i) < 2 elsif !namewidth or (namewidth = namewidth.to_i) < 2
namewidth = 25 namewidth = 25
end end
query = query.inject('') {|s, (k, v)| s << '&' << HTMLUtils::escape("#{k}=#{v}")} query = query.inject('') {|s, (k, v)| s << '&' << HTMLUtils::escape("#{k}=#{v}")}.dup
type = "text/html" type = +"text/html"
case enc = Encoding.find('filesystem') case enc = Encoding.find('filesystem')
when Encoding::US_ASCII, Encoding::ASCII_8BIT when Encoding::US_ASCII, Encoding::ASCII_8BIT
else else
@ -492,7 +492,7 @@ module WEBrick
res['content-type'] = type res['content-type'] = type
title = "Index of #{HTMLUtils::escape(req.path)}" title = "Index of #{HTMLUtils::escape(req.path)}"
res.body = <<-_end_of_html_ res.body = +<<-_end_of_html_
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML> <HTML>
<HEAD> <HEAD>
@ -528,7 +528,7 @@ module WEBrick
else else
dname = name dname = name
end end
s = "<TR><TD class=\"name\"><A HREF=\"#{HTTPUtils::escape(name)}#{query if name.end_with?('/')}\">#{HTMLUtils::escape(dname)}</A></TD>" s = +"<TR><TD class=\"name\"><A HREF=\"#{HTTPUtils::escape(name)}#{query if name.end_with?('/')}\">#{HTMLUtils::escape(dname)}</A></TD>"
s << "<TD class=\"mtime\">" << (time ? time.strftime("%Y/%m/%d %H:%M") : "") << "</TD>" s << "<TD class=\"mtime\">" << (time ? time.strftime("%Y/%m/%d %H:%M") : "") << "</TD>"
s << "<TD class=\"size\">" << (size >= 0 ? size.to_s : "-") << "</TD></TR>\n" s << "<TD class=\"size\">" << (size >= 0 ? size.to_s : "-") << "</TD></TR>\n"
res.body << s res.body << s

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# prochandler.rb -- ProcHandler Class # prochandler.rb -- ProcHandler Class
# #
@ -40,6 +40,7 @@ module WEBrick
end end
alias do_POST do_GET alias do_POST do_GET
alias do_PUT do_GET
# :startdoc: # :startdoc:
end end

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
#-- #--
# httpstatus.rb -- HTTPStatus Class # httpstatus.rb -- HTTPStatus Class
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# httputils.rb -- HTTPUtils Module # httputils.rb -- HTTPUtils Module
# #
@ -48,6 +48,7 @@ module WEBrick
"ai" => "application/postscript", "ai" => "application/postscript",
"asc" => "text/plain", "asc" => "text/plain",
"avi" => "video/x-msvideo", "avi" => "video/x-msvideo",
"avif" => "image/avif",
"bin" => "application/octet-stream", "bin" => "application/octet-stream",
"bmp" => "image/bmp", "bmp" => "image/bmp",
"class" => "application/octet-stream", "class" => "application/octet-stream",
@ -65,6 +66,7 @@ module WEBrick
"gif" => "image/gif", "gif" => "image/gif",
"htm" => "text/html", "htm" => "text/html",
"html" => "text/html", "html" => "text/html",
"ico" => "image/x-icon",
"jpe" => "image/jpeg", "jpe" => "image/jpeg",
"jpeg" => "image/jpeg", "jpeg" => "image/jpeg",
"jpg" => "image/jpeg", "jpg" => "image/jpeg",
@ -74,9 +76,11 @@ module WEBrick
"lzh" => "application/octet-stream", "lzh" => "application/octet-stream",
"mjs" => "application/javascript", "mjs" => "application/javascript",
"mov" => "video/quicktime", "mov" => "video/quicktime",
"mp4" => "video/mp4",
"mpe" => "video/mpeg", "mpe" => "video/mpeg",
"mpeg" => "video/mpeg", "mpeg" => "video/mpeg",
"mpg" => "video/mpeg", "mpg" => "video/mpeg",
"otf" => "font/otf",
"pbm" => "image/x-portable-bitmap", "pbm" => "image/x-portable-bitmap",
"pdf" => "application/pdf", "pdf" => "application/pdf",
"pgm" => "image/x-portable-graymap", "pgm" => "image/x-portable-graymap",
@ -95,8 +99,15 @@ module WEBrick
"svg" => "image/svg+xml", "svg" => "image/svg+xml",
"tif" => "image/tiff", "tif" => "image/tiff",
"tiff" => "image/tiff", "tiff" => "image/tiff",
"ttc" => "font/collection",
"ttf" => "font/ttf",
"txt" => "text/plain", "txt" => "text/plain",
"wasm" => "application/wasm", "wasm" => "application/wasm",
"webm" => "video/webm",
"webmanifest" => "application/manifest+json",
"webp" => "image/webp",
"woff" => "font/woff",
"woff2" => "font/woff2",
"xbm" => "image/x-xbitmap", "xbm" => "image/x-xbitmap",
"xhtml" => "text/html", "xhtml" => "text/html",
"xls" => "application/vnd.ms-excel", "xls" => "application/vnd.ms-excel",
@ -112,7 +123,7 @@ module WEBrick
def load_mime_types(file) def load_mime_types(file)
# note: +file+ may be a "| command" for now; some people may # note: +file+ may be a "| command" for now; some people may
# rely on this, but currently we do not use this method by default. # rely on this, but currently we do not use this method by default.
open(file){ |io| File.open(file){ |io|
hash = Hash.new hash = Hash.new
io.each{ |line| io.each{ |line|
next if /^#/ =~ line next if /^#/ =~ line
@ -231,7 +242,7 @@ module WEBrick
# Quotes and escapes quotes in +str+ # Quotes and escapes quotes in +str+
def quote(str) def quote(str)
'"' << str.gsub(/[\\\"]/o, "\\\1") << '"' +'"' << str.gsub(/[\\\"]/o, "\\\1") << '"'
end end
module_function :quote module_function :quote
@ -495,7 +506,7 @@ module WEBrick
# Escapes path +str+ # Escapes path +str+
def escape_path(str) def escape_path(str)
result = "" result = +""
str.scan(%r{/([^/]*)}).each{|i| str.scan(%r{/([^/]*)}).each{|i|
result << "/" << _escape(i[0], UNESCAPED_PCHAR) result << "/" << _escape(i[0], UNESCAPED_PCHAR)
} }

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
#-- #--
# HTTPVersion.rb -- presentation of HTTP version # HTTPVersion.rb -- presentation of HTTP version
# #

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
#-- #--
# log.rb -- Log Class # log.rb -- Log Class
# #
@ -86,15 +86,15 @@ module WEBrick
end end
# Shortcut for logging a FATAL message # Shortcut for logging a FATAL message
def fatal(msg) log(FATAL, "FATAL " << format(msg)); end def fatal(msg) log(FATAL, "FATAL " + format(msg)); end
# Shortcut for logging an ERROR message # Shortcut for logging an ERROR message
def error(msg) log(ERROR, "ERROR " << format(msg)); end def error(msg) log(ERROR, "ERROR " + format(msg)); end
# Shortcut for logging a WARN message # Shortcut for logging a WARN message
def warn(msg) log(WARN, "WARN " << format(msg)); end def warn(msg) log(WARN, "WARN " + format(msg)); end
# Shortcut for logging an INFO message # Shortcut for logging an INFO message
def info(msg) log(INFO, "INFO " << format(msg)); end def info(msg) log(INFO, "INFO " + format(msg)); end
# Shortcut for logging a DEBUG message # Shortcut for logging a DEBUG message
def debug(msg) log(DEBUG, "DEBUG " << format(msg)); end def debug(msg) log(DEBUG, "DEBUG " + format(msg)); end
# Will the logger output FATAL messages? # Will the logger output FATAL messages?
def fatal?; @level >= FATAL; end def fatal?; @level >= FATAL; end
@ -118,7 +118,7 @@ module WEBrick
# * Otherwise it will return +arg+.inspect. # * Otherwise it will return +arg+.inspect.
def format(arg) def format(arg)
if arg.is_a?(Exception) if arg.is_a?(Exception)
"#{arg.class}: #{AccessLog.escape(arg.message)}\n\t" << +"#{arg.class}: #{AccessLog.escape(arg.message)}\n\t" <<
arg.backtrace.join("\n\t") << "\n" arg.backtrace.join("\n\t") << "\n"
elsif arg.respond_to?(:to_str) elsif arg.respond_to?(:to_str)
AccessLog.escape(arg.to_str) AccessLog.escape(arg.to_str)

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# server.rb -- GenericServer Class # server.rb -- GenericServer Class
# #
@ -102,7 +102,7 @@ module WEBrick
@listeners = [] @listeners = []
@shutdown_pipe = nil @shutdown_pipe = nil
unless @config[:DoNotListen] unless @config[:DoNotListen]
raise ArgumentError, "Port must an integer" unless @config[:Port].to_s == @config[:Port].to_i.to_s raise ArgumentError, "Port must be an integer" unless @config[:Port].to_s == @config[:Port].to_i.to_s
@config[:Port] = @config[:Port].to_i @config[:Port] = @config[:Port].to_i
if @config[:Listen] if @config[:Listen]

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# ssl.rb -- SSL/TLS enhancement for GenericServer # ssl.rb -- SSL/TLS enhancement for GenericServer
# #
@ -95,18 +95,22 @@ module WEBrick
# the issuer +cn+ and a +comment+ to be stored in the certificate. # the issuer +cn+ and a +comment+ to be stored in the certificate.
def create_self_signed_cert(bits, cn, comment) def create_self_signed_cert(bits, cn, comment)
rsa = OpenSSL::PKey::RSA.new(bits){|p, n| rsa = if $VERBOSE
case p OpenSSL::PKey::RSA.new(bits){|p, n|
when 0; $stderr.putc "." # BN_generate_prime case p
when 1; $stderr.putc "+" # BN_generate_prime when 0; $stderr.putc "." # BN_generate_prime
when 2; $stderr.putc "*" # searching good prime, when 1; $stderr.putc "+" # BN_generate_prime
# n = #of try, when 2; $stderr.putc "*" # searching good prime,
# but also data from BN_generate_prime # n = #of try,
when 3; $stderr.putc "\n" # found good prime, n==0 - p, n==1 - q, # but also data from BN_generate_prime
# but also data from BN_generate_prime when 3; $stderr.putc "\n" # found good prime, n==0 - p, n==1 - q,
else; $stderr.putc "*" # BN_generate_prime # but also data from BN_generate_prime
end else; $stderr.putc "*" # BN_generate_prime
} end
}
else
OpenSSL::PKey::RSA.new(bits)
end
cert = OpenSSL::X509::Certificate.new cert = OpenSSL::X509::Certificate.new
cert.version = 2 cert.version = 2
cert.serial = 1 cert.serial = 1

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
# #
# utils.rb -- Miscellaneous utilities # utils.rb -- Miscellaneous utilities
# #
@ -78,7 +78,7 @@ module WEBrick
# Generates a random string of length +len+ # Generates a random string of length +len+
def random_string(len) def random_string(len)
rand_max = RAND_CHARS.bytesize rand_max = RAND_CHARS.bytesize
ret = "" ret = +""
len.times{ ret << RAND_CHARS[rand(rand_max)] } len.times{ ret << RAND_CHARS[rand(rand_max)] }
ret ret
end end

View File

@ -1,4 +1,4 @@
# frozen_string_literal: false # frozen_string_literal: true
#-- #--
# version.rb -- version and release date # version.rb -- version and release date
# #
@ -14,5 +14,5 @@ module WEBrick
## ##
# The WEBrick version # The WEBrick version
VERSION = "1.7.0" VERSION = "1.8.1"
end end