Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-webrick for openSUSE:Factory checked in at 2023-11-20 21:18:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-webrick (Old) and /work/SRC/openSUSE:Factory/.rubygem-webrick.new.2521 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-webrick" Mon Nov 20 21:18:26 2023 rev:2 rq:1126315 version:1.8.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-webrick/rubygem-webrick.changes 2021-08-05 20:48:36.887897581 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-webrick.new.2521/rubygem-webrick.changes 2023-11-20 21:18:28.092409598 +0100 @@ -1,0 +2,5 @@ +Tue Nov 14 15:44:11 UTC 2023 - Dan Äermák <dan.cer...@posteo.net> + +- New upstream release 1.8.1, no changelog found + +------------------------------------------------------------------- Old: ---- webrick-1.7.0.gem New: ---- webrick-1.8.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-webrick.spec ++++++ --- /var/tmp/diff_new_pack.lsXIby/_old 2023-11-20 21:18:28.812436172 +0100 +++ /var/tmp/diff_new_pack.lsXIby/_new 2023-11-20 21:18:28.812436172 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-webrick # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,26 +16,26 @@ # -%define mod_name webrick -%define mod_full_name %{mod_name}-%{version} # # This file was generated with a gem2rpm.yml and not just plain gem2rpm. # All sections marked as MANUAL, license headers, summaries and descriptions # can be maintained in that file. Please consult this file before editing any # of those fields # + Name: rubygem-webrick -Version: 1.7.0 +Version: 1.8.1 Release: 0 -Summary: HTTP server toolkit -License: Ruby AND BSD-2-Clause -Group: Development/Languages/Ruby +%define mod_name webrick +%define mod_full_name %{mod_name}-%{version} +BuildRequires: %{ruby >= 2.4.0} +BuildRequires: %{rubygem gem2rpm} +BuildRequires: ruby-macros >= 5 URL: https://github.com/ruby/webrick Source: https://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml -BuildRequires: %{ruby >= 2.3.0} -BuildRequires: %{rubygem gem2rpm} -BuildRequires: ruby-macros >= 5 +Summary: HTTP server toolkit +License: BSD-2-Clause AND Ruby %description WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, a ++++++ webrick-1.7.0.gem -> webrick-1.8.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 2020-12-11 04:05:56.000000000 +0100 +++ new/Gemfile 2023-01-27 12:16:18.000000000 +0100 @@ -1,3 +1,6 @@ source 'https://rubygems.org' gemspec + +gem "rake" +gem "test-unit" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2020-12-11 04:05:56.000000000 +0100 +++ new/README.md 2023-01-27 12:16:18.000000000 +0100 @@ -54,7 +54,7 @@ ## Contributing -Bug reports and Patch are welcome on https://bugs.ruby-lang.org/. +Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/webrick. ## License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2020-12-11 04:05:56.000000000 +0100 +++ new/Rakefile 2023-01-27 12:16:18.000000000 +0100 @@ -2,9 +2,16 @@ require "rake/testtask" Rake::TestTask.new(:test) do |t| - t.libs << "test" << "test/lib" - t.libs << "lib" - t.test_files = FileList['test/**/test_*.rb'] + t.libs << "test/lib" + t.ruby_opts << "-rhelper" + t.test_files = FileList["test/**/test_*.rb"] +end + +task :sync_tool do + require 'fileutils' + FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib" + FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib" + FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib" end task :default => :test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bin/console new/bin/console --- old/bin/console 2020-12-11 04:05:56.000000000 +0100 +++ new/bin/console 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby - -require "bundler/setup" -require "webrick" - -# You can add fixtures and/or initialization code here to make experimenting -# with your gem easier. You can also use a different console, if you like. - -# (If you use this, don't forget to add pry to your Gemfile!) -# require "pry" -# Pry.start - -require "irb" -IRB.start(__FILE__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bin/setup new/bin/setup --- old/bin/setup 2020-12-11 04:05:56.000000000 +0100 +++ new/bin/setup 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -IFS=$'\n\t' -set -vx - -bundle install - -# Do any other automated setup that you need to do here Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/accesslog.rb new/lib/webrick/accesslog.rb --- old/lib/webrick/accesslog.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/accesslog.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # accesslog.rb -- Access log handling utilities # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/cgi.rb new/lib/webrick/cgi.rb --- old/lib/webrick/cgi.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/cgi.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # cgi.rb -- Yet another CGI library # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/compat.rb new/lib/webrick/compat.rb --- old/lib/webrick/compat.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/compat.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # compat.rb -- cross platform compatibility # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/config.rb new/lib/webrick/config.rb --- old/lib/webrick/config.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/config.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # config.rb -- Default configurations. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/cookie.rb new/lib/webrick/cookie.rb --- old/lib/webrick/cookie.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/cookie.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # cookie.rb -- Cookie class # @@ -92,7 +92,7 @@ # The cookie string suitable for use in an HTTP header def to_s - ret = "" + ret = +"" ret << @name << "=" << @value ret << "; " << "Version=" << @version.to_s if @version > 0 ret << "; " << "Domain=" << @domain if @domain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/htmlutils.rb new/lib/webrick/htmlutils.rb --- old/lib/webrick/htmlutils.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/htmlutils.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # htmlutils.rb -- HTMLUtils Module # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpauth/authenticator.rb new/lib/webrick/httpauth/authenticator.rb --- old/lib/webrick/httpauth/authenticator.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpauth/authenticator.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # httpauth/authenticator.rb -- Authenticator mix-in module. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpauth/basicauth.rb new/lib/webrick/httpauth/basicauth.rb --- old/lib/webrick/httpauth/basicauth.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpauth/basicauth.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpauth/basicauth.rb -- HTTP basic access authentication # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpauth/digestauth.rb new/lib/webrick/httpauth/digestauth.rb --- old/lib/webrick/httpauth/digestauth.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpauth/digestauth.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpauth/digestauth.rb -- HTTP digest access authentication # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpauth/htdigest.rb new/lib/webrick/httpauth/htdigest.rb --- old/lib/webrick/httpauth/htdigest.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpauth/htdigest.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpauth/htdigest.rb -- Apache compatible htdigest file # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpauth/htgroup.rb new/lib/webrick/httpauth/htgroup.rb --- old/lib/webrick/httpauth/htgroup.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpauth/htgroup.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpauth/htgroup.rb -- Apache compatible htgroup file # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpauth/htpasswd.rb new/lib/webrick/httpauth/htpasswd.rb --- old/lib/webrick/httpauth/htpasswd.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpauth/htpasswd.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpauth/htpasswd -- Apache compatible htpasswd file # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpauth/userdb.rb new/lib/webrick/httpauth/userdb.rb --- old/lib/webrick/httpauth/userdb.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpauth/userdb.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # httpauth/userdb.rb -- UserDB mix-in module. # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpauth.rb new/lib/webrick/httpauth.rb --- old/lib/webrick/httpauth.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpauth.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpauth.rb -- HTTP access authentication # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpproxy.rb new/lib/webrick/httpproxy.rb --- old/lib/webrick/httpproxy.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpproxy.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpproxy.rb -- HTTPProxy Class # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httprequest.rb new/lib/webrick/httprequest.rb --- old/lib/webrick/httprequest.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httprequest.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httprequest.rb -- HTTPRequest Class # @@ -171,7 +171,7 @@ @accept_charset = [] @accept_encoding = [] @accept_language = [] - @body = "" + @body = +"" @addr = @peeraddr = nil @attributes = {} @@ -491,8 +491,7 @@ if @forwarded_host host, port = @forwarded_host, @forwarded_port elsif self["host"] - pattern = /\A(#{URI::REGEXP::PATTERN::HOST})(?::(\d+))?\z/n - host, port = *self['host'].scan(pattern)[0] + host, port = parse_host_request_line(self["host"]) elsif @addr.size > 0 host, port = @addr[2], @addr[1] else @@ -504,6 +503,11 @@ return URI::parse(uri.to_s) 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) return unless socket if tc = self['transfer-encoding'] @@ -522,7 +526,7 @@ if @remaining_size > 0 && @socket.eof? raise HTTPStatus::BadRequest, "invalid body size." end - elsif BODY_CONTAINABLE_METHODS.member?(@request_method) && !@socket.eof + elsif BODY_CONTAINABLE_METHODS.member?(@request_method) raise HTTPStatus::LengthRequired end return @body diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpresponse.rb new/lib/webrick/httpresponse.rb --- old/lib/webrick/httpresponse.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpresponse.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpresponse.rb -- HTTPResponse Class # @@ -106,6 +106,11 @@ 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 # default configuration. @@ -117,7 +122,7 @@ @status = HTTPStatus::RC_OK @reason_phrase = nil @http_version = HTTPVersion::convert(@config[:HTTPVersion]) - @body = '' + @body = +"" @keep_alive = true @cookies = [] @request_method = nil @@ -218,6 +223,16 @@ 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+ def send_response(socket) # :nodoc: @@ -242,6 +257,14 @@ @header['server'] ||= @config[:ServerSoftware] @header['date'] ||= Time.now.httpdate + if @upgrade + @header['connection'] = 'upgrade' + @header['upgrade'] = @upgrade + @keep_alive = false + + return + end + # HTTP/0.9 features if @request_http_version < "1.0" @http_version = HTTPVersion.new("0.9") @@ -268,11 +291,10 @@ elsif %r{^multipart/byteranges} =~ @header['content-type'] @header.delete('content-length') elsif @header['content-length'].nil? - if @body.respond_to? :readpartial - elsif @body.respond_to? :call - make_body_tempfile + if @body.respond_to?(:bytesize) + @header['content-length'] = @body.bytesize.to_s else - @header['content-length'] = (@body ? @body.bytesize : 0).to_s + @header['connection'] = 'close' end end @@ -332,7 +354,7 @@ def send_header(socket) # :nodoc: if @http_version.major > 0 - data = status_line() + data = status_line().dup @header.each{|key, value| tmp = key.gsub(/\bwww|^te$|\b\w/){ $&.upcase } data << "#{tmp}: #{check_header(value)}" << CRLF @@ -419,7 +441,7 @@ # :stopdoc: def error_body(backtrace, ex, host, port) - @body = '' + @body = +"" @body << <<-_end_of_html_ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <HTML> @@ -453,11 +475,11 @@ if @request_method == "HEAD" # do nothing elsif chunked? - buf = '' + buf = +'' begin @body.readpartial(@buffer_size, buf) size = buf.bytesize - data = "#{size.to_s(16)}#{CRLF}#{buf}#{CRLF}" + data = +"#{size.to_s(16)}#{CRLF}#{buf}#{CRLF}" socket.write(data) data.clear @sent_size += size @@ -517,14 +539,16 @@ @body.call(ChunkedWrapper.new(socket, self)) socket.write("0#{CRLF}#{CRLF}") else - size = @header['content-length'].to_i if @bodytempfile @bodytempfile.rewind IO.copy_stream(@bodytempfile, socket) else @body.call(socket) end - @sent_size = size + + if content_length = @header['content-length'] + @sent_size = content_length.to_i + end end end @@ -539,7 +563,7 @@ socket = @socket @resp.instance_eval { size = buf.bytesize - data = "#{size.to_s(16)}#{CRLF}#{buf}#{CRLF}" + data = +"#{size.to_s(16)}#{CRLF}#{buf}#{CRLF}" socket.write(data) data.clear @sent_size += size diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/https.rb new/lib/webrick/https.rb --- old/lib/webrick/https.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/https.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # https.rb -- SSL/TLS enhancement for HTTPServer # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpserver.rb new/lib/webrick/httpserver.rb --- old/lib/webrick/httpserver.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpserver.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpserver.rb -- HTTPServer Class # @@ -285,7 +285,7 @@ end def normalize(dir) - ret = dir ? dir.dup : "" + ret = dir ? dir.dup : +"" ret.sub!(%r|/+\z|, "") ret end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpservlet/abstract.rb new/lib/webrick/httpservlet/abstract.rb --- old/lib/webrick/httpservlet/abstract.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpservlet/abstract.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpservlet.rb -- HTTPServlet Module # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpservlet/cgi_runner.rb new/lib/webrick/httpservlet/cgi_runner.rb --- old/lib/webrick/httpservlet/cgi_runner.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpservlet/cgi_runner.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # cgi_runner.rb -- CGI launcher. # @@ -10,7 +10,7 @@ # $IPR: cgi_runner.rb,v 1.9 2002/09/25 11:33:15 gotoyuzo Exp $ def sysread(io, size) - buf = "" + buf = +"" while size > 0 tmp = io.sysread(size) buf << tmp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpservlet/cgihandler.rb new/lib/webrick/httpservlet/cgihandler.rb --- old/lib/webrick/httpservlet/cgihandler.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpservlet/cgihandler.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # cgihandler.rb -- CGIHandler Class # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpservlet/erbhandler.rb new/lib/webrick/httpservlet/erbhandler.rb --- old/lib/webrick/httpservlet/erbhandler.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpservlet/erbhandler.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # erbhandler.rb -- ERBHandler Class # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpservlet/filehandler.rb new/lib/webrick/httpservlet/filehandler.rb --- old/lib/webrick/httpservlet/filehandler.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpservlet/filehandler.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # filehandler.rb -- FileHandler Module # @@ -481,9 +481,9 @@ elsif !namewidth or (namewidth = namewidth.to_i) < 2 namewidth = 25 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') when Encoding::US_ASCII, Encoding::ASCII_8BIT else @@ -492,7 +492,7 @@ res['content-type'] = type 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"> <HTML> <HEAD> @@ -528,7 +528,7 @@ else dname = name 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=\"size\">" << (size >= 0 ? size.to_s : "-") << "</TD></TR>\n" res.body << s diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpservlet/prochandler.rb new/lib/webrick/httpservlet/prochandler.rb --- old/lib/webrick/httpservlet/prochandler.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpservlet/prochandler.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # prochandler.rb -- ProcHandler Class # @@ -40,6 +40,7 @@ end alias do_POST do_GET + alias do_PUT do_GET # :startdoc: end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpservlet.rb new/lib/webrick/httpservlet.rb --- old/lib/webrick/httpservlet.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpservlet.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httpservlet.rb -- HTTPServlet Utility File # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpstatus.rb new/lib/webrick/httpstatus.rb --- old/lib/webrick/httpstatus.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpstatus.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # httpstatus.rb -- HTTPStatus Class # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httputils.rb new/lib/webrick/httputils.rb --- old/lib/webrick/httputils.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httputils.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # httputils.rb -- HTTPUtils Module # @@ -48,6 +48,7 @@ "ai" => "application/postscript", "asc" => "text/plain", "avi" => "video/x-msvideo", + "avif" => "image/avif", "bin" => "application/octet-stream", "bmp" => "image/bmp", "class" => "application/octet-stream", @@ -65,6 +66,7 @@ "gif" => "image/gif", "htm" => "text/html", "html" => "text/html", + "ico" => "image/x-icon", "jpe" => "image/jpeg", "jpeg" => "image/jpeg", "jpg" => "image/jpeg", @@ -74,9 +76,11 @@ "lzh" => "application/octet-stream", "mjs" => "application/javascript", "mov" => "video/quicktime", + "mp4" => "video/mp4", "mpe" => "video/mpeg", "mpeg" => "video/mpeg", "mpg" => "video/mpeg", + "otf" => "font/otf", "pbm" => "image/x-portable-bitmap", "pdf" => "application/pdf", "pgm" => "image/x-portable-graymap", @@ -95,8 +99,15 @@ "svg" => "image/svg+xml", "tif" => "image/tiff", "tiff" => "image/tiff", + "ttc" => "font/collection", + "ttf" => "font/ttf", "txt" => "text/plain", "wasm" => "application/wasm", + "webm" => "video/webm", + "webmanifest" => "application/manifest+json", + "webp" => "image/webp", + "woff" => "font/woff", + "woff2" => "font/woff2", "xbm" => "image/x-xbitmap", "xhtml" => "text/html", "xls" => "application/vnd.ms-excel", @@ -112,7 +123,7 @@ def load_mime_types(file) # note: +file+ may be a "| command" for now; some people may # rely on this, but currently we do not use this method by default. - open(file){ |io| + File.open(file){ |io| hash = Hash.new io.each{ |line| next if /^#/ =~ line @@ -231,7 +242,7 @@ # Quotes and escapes quotes in +str+ def quote(str) - '"' << str.gsub(/[\\\"]/o, "\\\1") << '"' + +'"' << str.gsub(/[\\\"]/o, "\\\1") << '"' end module_function :quote @@ -495,7 +506,7 @@ # Escapes path +str+ def escape_path(str) - result = "" + result = +"" str.scan(%r{/([^/]*)}).each{|i| result << "/" << _escape(i[0], UNESCAPED_PCHAR) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/httpversion.rb new/lib/webrick/httpversion.rb --- old/lib/webrick/httpversion.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/httpversion.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # HTTPVersion.rb -- presentation of HTTP version # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/log.rb new/lib/webrick/log.rb --- old/lib/webrick/log.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/log.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # log.rb -- Log Class # @@ -86,15 +86,15 @@ end # 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 - def error(msg) log(ERROR, "ERROR " << format(msg)); end + def error(msg) log(ERROR, "ERROR " + format(msg)); end # 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 - def info(msg) log(INFO, "INFO " << format(msg)); end + def info(msg) log(INFO, "INFO " + format(msg)); end # 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? def fatal?; @level >= FATAL; end @@ -118,7 +118,7 @@ # * Otherwise it will return +arg+.inspect. def format(arg) 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" elsif arg.respond_to?(:to_str) AccessLog.escape(arg.to_str) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/server.rb new/lib/webrick/server.rb --- old/lib/webrick/server.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/server.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # server.rb -- GenericServer Class # @@ -102,7 +102,7 @@ @listeners = [] @shutdown_pipe = nil 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 if @config[:Listen] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/ssl.rb new/lib/webrick/ssl.rb --- old/lib/webrick/ssl.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/ssl.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # ssl.rb -- SSL/TLS enhancement for GenericServer # @@ -95,18 +95,22 @@ # the issuer +cn+ and a +comment+ to be stored in the certificate. def create_self_signed_cert(bits, cn, comment) - rsa = OpenSSL::PKey::RSA.new(bits){|p, n| - case p - when 0; $stderr.putc "." # BN_generate_prime - when 1; $stderr.putc "+" # BN_generate_prime - when 2; $stderr.putc "*" # searching good prime, - # n = #of try, - # but also data from BN_generate_prime - when 3; $stderr.putc "\n" # found good prime, n==0 - p, n==1 - q, - # but also data from BN_generate_prime - else; $stderr.putc "*" # BN_generate_prime - end - } + rsa = if $VERBOSE + OpenSSL::PKey::RSA.new(bits){|p, n| + case p + when 0; $stderr.putc "." # BN_generate_prime + when 1; $stderr.putc "+" # BN_generate_prime + when 2; $stderr.putc "*" # searching good prime, + # n = #of try, + # but also data from BN_generate_prime + when 3; $stderr.putc "\n" # found good prime, n==0 - p, n==1 - q, + # but also data from BN_generate_prime + else; $stderr.putc "*" # BN_generate_prime + end + } + else + OpenSSL::PKey::RSA.new(bits) + end cert = OpenSSL::X509::Certificate.new cert.version = 2 cert.serial = 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/utils.rb new/lib/webrick/utils.rb --- old/lib/webrick/utils.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/utils.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # # utils.rb -- Miscellaneous utilities # @@ -78,7 +78,7 @@ # Generates a random string of length +len+ def random_string(len) rand_max = RAND_CHARS.bytesize - ret = "" + ret = +"" len.times{ ret << RAND_CHARS[rand(rand_max)] } ret end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/webrick/version.rb new/lib/webrick/version.rb --- old/lib/webrick/version.rb 2020-12-11 04:05:56.000000000 +0100 +++ new/lib/webrick/version.rb 2023-01-27 12:16:18.000000000 +0100 @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # version.rb -- version and release date # @@ -14,5 +14,5 @@ ## # The WEBrick version - VERSION = "1.7.0" + VERSION = "1.8.1" end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2020-12-11 04:05:56.000000000 +0100 +++ new/metadata 2023-01-27 12:16:18.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: webrick version: !ruby/object:Gem::Version - version: 1.7.0 + version: 1.8.1 platform: ruby authors: - TAKAHASHI Masayoshi @@ -10,22 +10,8 @@ autorequire: bindir: bin cert_chain: [] -date: 2020-12-11 00:00:00.000000000 Z -dependencies: -- !ruby/object:Gem::Dependency - name: rake - requirement: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: '0' - type: :development - prerelease: false - version_requirements: !ruby/object:Gem::Requirement - requirements: - - - ">=" - - !ruby/object:Gem::Version - version: '0' +date: 2023-01-27 00:00:00.000000000 Z +dependencies: [] description: WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server. email: @@ -40,8 +26,6 @@ - LICENSE.txt - README.md - Rakefile -- bin/console -- bin/setup - lib/webrick.rb - lib/webrick/accesslog.rb - lib/webrick/cgi.rb @@ -92,14 +76,14 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: 2.3.0 + version: 2.4.0 required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.2.0 +rubygems_version: 3.5.0.dev signing_key: specification_version: 4 summary: HTTP server toolkit diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/webrick.gemspec new/webrick.gemspec --- old/webrick.gemspec 2020-12-11 04:05:56.000000000 +0100 +++ new/webrick.gemspec 2023-01-27 12:16:18.000000000 +0100 @@ -18,8 +18,6 @@ "LICENSE.txt", "README.md", "Rakefile", - "bin/console", - "bin/setup", "lib/webrick.rb", "lib/webrick/accesslog.rb", "lib/webrick/cgi.rb", @@ -57,7 +55,7 @@ "lib/webrick/version.rb", "webrick.gemspec", ] - s.required_ruby_version = ">= 2.3.0" + s.required_ruby_version = ">= 2.4.0" s.authors = ["TAKAHASHI Masayoshi", "GOTOU YUUZOU", "Eric Wong"] s.email = [nil, nil, 'nor...@ruby-lang.org'] @@ -69,6 +67,4 @@ "bug_tracker_uri" => "https://github.com/ruby/webrick/issues", } end - - s.add_development_dependency "rake" end