Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-addressable for openSUSE:Factory checked in at 2022-08-28 13:12:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-addressable (Old) and /work/SRC/openSUSE:Factory/.rubygem-addressable.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-addressable" Sun Aug 28 13:12:10 2022 rev:22 rq:999444 version:2.8.1 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-addressable/rubygem-addressable.changes 2021-07-13 22:37:02.766316546 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-addressable.new.2083/rubygem-addressable.changes 2022-08-28 13:12:10.864523052 +0200 @@ -1,0 +2,20 @@ +Fri Aug 26 16:08:46 UTC 2022 - Manuel Schnitzer <mschnit...@suse.com> + +- updated to version 2.8.1 + + * refactor `Addressable::URI.normalize_path` to address linter offenses ([#430](https://github.com/sporkmonger/addressable/pull/430)) + * remove redundant colon in `Addressable::URI::CharacterClasses::AUTHORITY` regex ([#438](https://github.com/sporkmonger/addressable/pull/438)) + * update gemspec to reflect supported Ruby versions ([#466], [#464], [#463]) + * compatibility w/ public_suffix 5.x ([#466], [#465], [#460]) + * fixes "invalid byte sequence in UTF-8" exception when unencoding URLs containing non UTF-8 characters ([#459](https://github.com/sporkmonger/addressable/pull/459)) + * `Ractor` compatibility ([#449](https://github.com/sporkmonger/addressable/pull/449)) + * use the whole string instead of a single line for template match ([#431](https://github.com/sporkmonger/addressable/pull/431)) + * force UTF-8 encoding only if needed ([#341](https://github.com/sporkmonger/addressable/pull/341)) + + [#460]: https://github.com/sporkmonger/addressable/pull/460 + [#463]: https://github.com/sporkmonger/addressable/pull/463 + [#464]: https://github.com/sporkmonger/addressable/pull/464 + [#465]: https://github.com/sporkmonger/addressable/pull/465 + [#466]: https://github.com/sporkmonger/addressable/pull/466 + +------------------------------------------------------------------- Old: ---- addressable-2.8.0.gem New: ---- addressable-2.8.1.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-addressable.spec ++++++ --- /var/tmp/diff_new_pack.WD633q/_old 2022-08-28 13:12:12.364526878 +0200 +++ /var/tmp/diff_new_pack.WD633q/_new 2022-08-28 13:12:12.368526887 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-addressable # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,12 +24,12 @@ # Name: rubygem-addressable -Version: 2.8.0 +Version: 2.8.1 Release: 0 %define mod_name addressable %define mod_full_name %{mod_name}-%{version} BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: %{ruby >= 2.0} +BuildRequires: %{ruby >= 2.2} BuildRequires: %{rubygem gem2rpm} BuildRequires: %{rubygem rdoc > 3.10} BuildRequires: ruby-macros >= 5 ++++++ addressable-2.8.0.gem -> addressable-2.8.1.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 2021-07-03 06:27:42.000000000 +0200 +++ new/CHANGELOG.md 2022-08-19 12:48:27.000000000 +0200 @@ -1,3 +1,19 @@ +# Addressable 2.8.1 +- refactor `Addressable::URI.normalize_path` to address linter offenses ([#430](https://github.com/sporkmonger/addressable/pull/430)) +- remove redundant colon in `Addressable::URI::CharacterClasses::AUTHORITY` regex ([#438](https://github.com/sporkmonger/addressable/pull/438)) +- update gemspec to reflect supported Ruby versions ([#466], [#464], [#463]) +- compatibility w/ public_suffix 5.x ([#466], [#465], [#460]) +- fixes "invalid byte sequence in UTF-8" exception when unencoding URLs containing non UTF-8 characters ([#459](https://github.com/sporkmonger/addressable/pull/459)) +- `Ractor` compatibility ([#449](https://github.com/sporkmonger/addressable/pull/449)) +- use the whole string instead of a single line for template match ([#431](https://github.com/sporkmonger/addressable/pull/431)) +- force UTF-8 encoding only if needed ([#341](https://github.com/sporkmonger/addressable/pull/341)) + +[#460]: https://github.com/sporkmonger/addressable/pull/460 +[#463]: https://github.com/sporkmonger/addressable/pull/463 +[#464]: https://github.com/sporkmonger/addressable/pull/464 +[#465]: https://github.com/sporkmonger/addressable/pull/465 +[#466]: https://github.com/sporkmonger/addressable/pull/466 + # Addressable 2.8.0 - fixes ReDoS vulnerability in Addressable::Template#match - no longer replaces `+` with spaces in queries for non-http(s) schemes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 2021-07-03 06:27:42.000000000 +0200 +++ new/Gemfile 2022-08-19 12:48:27.000000000 +0200 @@ -2,7 +2,7 @@ source 'https://rubygems.org' -gemspec(path: __FILE__ == "(eval)" ? ".." : ".") +gemspec group :test do gem 'rspec', '~> 3.8' @@ -25,4 +25,6 @@ gem "rake", ">= 12.3.3" end -gem "idn-ruby", platform: :mri +unless ENV["IDNA_MODE"] == "pure" + gem "idn-ruby", platform: :mri +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/addressable.gemspec new/addressable.gemspec --- old/addressable.gemspec 2021-07-03 06:27:42.000000000 +0200 +++ new/addressable.gemspec 1970-01-01 01:00:00.000000000 +0100 @@ -1,37 +0,0 @@ -# -*- encoding: utf-8 -*- -# stub: addressable 2.8.0 ruby lib - -Gem::Specification.new do |s| - s.name = "addressable".freeze - s.version = "2.8.0" - - s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= - s.require_paths = ["lib".freeze] - s.authors = ["Bob Aman".freeze] - s.date = "2021-07-03" - s.description = "Addressable is an alternative implementation to the URI implementation that is\npart of Ruby's standard library. It is flexible, offers heuristic parsing, and\nadditionally provides extensive support for IRIs and URI templates.\n".freeze - s.email = "b...@sporkmonger.com".freeze - s.extra_rdoc_files = ["README.md".freeze] - s.files = ["CHANGELOG.md".freeze, "Gemfile".freeze, "LICENSE.txt".freeze, "README.md".freeze, "Rakefile".freeze, "addressable.gemspec".freeze, "data/unicode.data".freeze, "lib/addressable.rb".freeze, "lib/addressable/idna.rb".freeze, "lib/addressable/idna/native.rb".freeze, "lib/addressable/idna/pure.rb".freeze, "lib/addressable/template.rb".freeze, "lib/addressable/uri.rb".freeze, "lib/addressable/version.rb".freeze, "spec/addressable/idna_spec.rb".freeze, "spec/addressable/net_http_compat_spec.rb".freeze, "spec/addressable/security_spec.rb".freeze, "spec/addressable/template_spec.rb".freeze, "spec/addressable/uri_spec.rb".freeze, "spec/spec_helper.rb".freeze, "tasks/clobber.rake".freeze, "tasks/gem.rake".freeze, "tasks/git.rake".freeze, "tasks/metrics.rake".freeze, "tasks/profile.rake".freeze, "tasks/rspec.rake".freeze, "tasks/yard.rake".freeze] - s.homepage = "https://github.com/sporkmonger/addressable".freeze - s.licenses = ["Apache-2.0".freeze] - s.rdoc_options = ["--main".freeze, "README.md".freeze] - s.required_ruby_version = Gem::Requirement.new(">= 2.0".freeze) - s.rubygems_version = "3.0.3".freeze - s.summary = "URI Implementation".freeze - - if s.respond_to? :specification_version then - s.specification_version = 4 - - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q<public_suffix>.freeze, [">= 2.0.2", "< 5.0"]) - s.add_development_dependency(%q<bundler>.freeze, [">= 1.0", "< 3.0"]) - else - s.add_dependency(%q<public_suffix>.freeze, [">= 2.0.2", "< 5.0"]) - s.add_dependency(%q<bundler>.freeze, [">= 1.0", "< 3.0"]) - end - else - s.add_dependency(%q<public_suffix>.freeze, [">= 2.0.2", "< 5.0"]) - s.add_dependency(%q<bundler>.freeze, [">= 1.0", "< 3.0"]) - end -end Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/addressable/idna/native.rb new/lib/addressable/idna/native.rb --- old/lib/addressable/idna/native.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/lib/addressable/idna/native.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# encoding:utf-8 #-- # Copyright (C) Bob Aman # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/addressable/idna/pure.rb new/lib/addressable/idna/pure.rb --- old/lib/addressable/idna/pure.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/lib/addressable/idna/pure.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# encoding:utf-8 #-- # Copyright (C) Bob Aman # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/addressable/idna.rb new/lib/addressable/idna.rb --- old/lib/addressable/idna.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/lib/addressable/idna.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# encoding:utf-8 #-- # Copyright (C) Bob Aman # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/addressable/template.rb new/lib/addressable/template.rb --- old/lib/addressable/template.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/lib/addressable/template.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# encoding:utf-8 #-- # Copyright (C) Bob Aman # @@ -657,12 +656,12 @@ def ordered_variable_defaults @ordered_variable_defaults ||= begin expansions, _ = parse_template_pattern(pattern) - expansions.map do |capture| + expansions.flat_map do |capture| _, _, varlist = *capture.match(EXPRESSION) varlist.split(',').map do |varspec| varspec[VARSPEC, 1] end - end.flatten + end end end @@ -1023,7 +1022,7 @@ end # Ensure that the regular expression matches the whole URI. - regexp_string = "^#{regexp_string}$" + regexp_string = "\\A#{regexp_string}\\z" return expansions, Regexp.new(regexp_string) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/addressable/uri.rb new/lib/addressable/uri.rb --- old/lib/addressable/uri.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/lib/addressable/uri.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# encoding:utf-8 #-- # Copyright (C) Bob Aman # @@ -38,20 +37,26 @@ ## # Container for the character classes specified in # <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>. + # + # Note: Concatenated and interpolated `String`s are not affected by the + # `frozen_string_literal` directive and must be frozen explicitly. + # + # Interpolated `String`s *were* frozen this way before Ruby 3.0: + # https://bugs.ruby-lang.org/issues/17104 module CharacterClasses ALPHA = "a-zA-Z" DIGIT = "0-9" GEN_DELIMS = "\\:\\/\\?\\#\\[\\]\\@" SUB_DELIMS = "\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=" - RESERVED = GEN_DELIMS + SUB_DELIMS - UNRESERVED = ALPHA + DIGIT + "\\-\\.\\_\\~" - PCHAR = UNRESERVED + SUB_DELIMS + "\\:\\@" - SCHEME = ALPHA + DIGIT + "\\-\\+\\." - HOST = UNRESERVED + SUB_DELIMS + "\\[\\:\\]" - AUTHORITY = PCHAR + "\\[\\:\\]" - PATH = PCHAR + "\\/" - QUERY = PCHAR + "\\/\\?" - FRAGMENT = PCHAR + "\\/\\?" + RESERVED = (GEN_DELIMS + SUB_DELIMS).freeze + UNRESERVED = (ALPHA + DIGIT + "\\-\\.\\_\\~").freeze + PCHAR = (UNRESERVED + SUB_DELIMS + "\\:\\@").freeze + SCHEME = (ALPHA + DIGIT + "\\-\\+\\.").freeze + HOST = (UNRESERVED + SUB_DELIMS + "\\[\\:\\]").freeze + AUTHORITY = (PCHAR + "\\[\\:\\]").freeze + PATH = (PCHAR + "\\/").freeze + QUERY = (PCHAR + "\\/\\?").freeze + FRAGMENT = (PCHAR + "\\/\\?").freeze end module NormalizeCharacterClasses @@ -469,19 +474,13 @@ "Expected Class (String or Addressable::URI), " + "got #{return_type.inspect}" end - uri = uri.dup - # Seriously, only use UTF-8. I'm really not kidding! - uri.force_encoding("utf-8") - - unless leave_encoded.empty? - leave_encoded = leave_encoded.dup.force_encoding("utf-8") - end - result = uri.gsub(/%[0-9a-f]{2}/iu) do |sequence| + result = uri.gsub(/%[0-9a-f]{2}/i) do |sequence| c = sequence[1..3].to_i(16).chr - c.force_encoding("utf-8") + c.force_encoding(sequence.encoding) leave_encoded.include?(c) ? sequence : c end + result.force_encoding("utf-8") if return_type == String return result @@ -561,10 +560,10 @@ leave_re = if leave_encoded.length > 0 character_class = "#{character_class}%" unless character_class.include?('%') - "|%(?!#{leave_encoded.chars.map do |char| + "|%(?!#{leave_encoded.chars.flat_map do |char| seq = SEQUENCE_ENCODING_TABLE[char] [seq.upcase, seq.downcase] - end.flatten.join('|')})" + end.join('|')})" end character_class = if leave_re @@ -900,7 +899,7 @@ end end # All normalized values should be UTF-8 - @normalized_scheme.force_encoding(Encoding::UTF_8) if @normalized_scheme + force_utf8_encoding_if_needed(@normalized_scheme) @normalized_scheme end @@ -955,7 +954,7 @@ end end # All normalized values should be UTF-8 - @normalized_user.force_encoding(Encoding::UTF_8) if @normalized_user + force_utf8_encoding_if_needed(@normalized_user) @normalized_user end @@ -1012,9 +1011,7 @@ end end # All normalized values should be UTF-8 - if @normalized_password - @normalized_password.force_encoding(Encoding::UTF_8) - end + force_utf8_encoding_if_needed(@normalized_password) @normalized_password end @@ -1082,9 +1079,7 @@ end end # All normalized values should be UTF-8 - if @normalized_userinfo - @normalized_userinfo.force_encoding(Encoding::UTF_8) - end + force_utf8_encoding_if_needed(@normalized_userinfo) @normalized_userinfo end @@ -1151,9 +1146,7 @@ end end # All normalized values should be UTF-8 - if @normalized_host && !@normalized_host.empty? - @normalized_host.force_encoding(Encoding::UTF_8) - end + force_utf8_encoding_if_needed(@normalized_host) @normalized_host end @@ -1271,9 +1264,7 @@ authority end # All normalized values should be UTF-8 - if @normalized_authority - @normalized_authority.force_encoding(Encoding::UTF_8) - end + force_utf8_encoding_if_needed(@normalized_authority) @normalized_authority end @@ -1507,7 +1498,7 @@ site_string end # All normalized values should be UTF-8 - @normalized_site.force_encoding(Encoding::UTF_8) if @normalized_site + force_utf8_encoding_if_needed(@normalized_site) @normalized_site end @@ -1570,7 +1561,7 @@ result end # All normalized values should be UTF-8 - @normalized_path.force_encoding(Encoding::UTF_8) if @normalized_path + force_utf8_encoding_if_needed(@normalized_path) @normalized_path end @@ -1646,7 +1637,7 @@ component == "" ? nil : component end # All normalized values should be UTF-8 - @normalized_query.force_encoding(Encoding::UTF_8) if @normalized_query + force_utf8_encoding_if_needed(@normalized_query) @normalized_query end @@ -1842,9 +1833,7 @@ component == "" ? nil : component end # All normalized values should be UTF-8 - if @normalized_fragment - @normalized_fragment.force_encoding(Encoding::UTF_8) - end + force_utf8_encoding_if_needed(@normalized_fragment) @normalized_fragment end @@ -2440,30 +2429,35 @@ def self.normalize_path(path) # Section 5.2.4 of RFC 3986 - return nil if path.nil? + return if path.nil? normalized_path = path.dup - begin - mod = nil + loop do mod ||= normalized_path.gsub!(RULE_2A, SLASH) pair = normalized_path.match(RULE_2B_2C) - parent, current = pair[1], pair[2] if pair + if pair + parent = pair[1] + current = pair[2] + else + parent = nil + current = nil + end + + regexp = "/#{Regexp.escape(parent.to_s)}/\\.\\./|" + regexp += "(/#{Regexp.escape(current.to_s)}/\\.\\.$)" + if pair && ((parent != SELF_REF && parent != PARENT) || (current != SELF_REF && current != PARENT)) - mod ||= normalized_path.gsub!( - Regexp.new( - "/#{Regexp.escape(parent.to_s)}/\\.\\./|" + - "(/#{Regexp.escape(current.to_s)}/\\.\\.$)" - ), SLASH - ) + mod ||= normalized_path.gsub!(Regexp.new(regexp), SLASH) end mod ||= normalized_path.gsub!(RULE_2D, EMPTY_STR) # Non-standard, removes prefixed dotted segments from path. mod ||= normalized_path.gsub!(RULE_PREFIXED_PARENT, SLASH) - end until mod.nil? + break if mod.nil? + end - return normalized_path + normalized_path end ## @@ -2552,5 +2546,15 @@ remove_instance_variable(:@uri_string) if defined?(@uri_string) remove_instance_variable(:@hash) if defined?(@hash) end + + ## + # Converts the string to be UTF-8 if it is not already UTF-8 + # + # @api private + def force_utf8_encoding_if_needed(str) + if str && str.encoding != Encoding::UTF_8 + str.force_encoding(Encoding::UTF_8) + end + end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/addressable/version.rb new/lib/addressable/version.rb --- old/lib/addressable/version.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/lib/addressable/version.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# encoding:utf-8 #-- # Copyright (C) Bob Aman # @@ -24,7 +23,7 @@ module VERSION MAJOR = 2 MINOR = 8 - TINY = 0 + TINY = 1 STRING = [MAJOR, MINOR, TINY].join('.') end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2021-07-03 06:27:42.000000000 +0200 +++ new/metadata 2022-08-19 12:48:27.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: addressable version: !ruby/object:Gem::Version - version: 2.8.0 + version: 2.8.1 platform: ruby authors: - Bob Aman -autorequire: +autorequire: bindir: bin cert_chain: [] -date: 2021-07-03 00:00:00.000000000 Z +date: 2022-08-19 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: public_suffix @@ -19,7 +19,7 @@ version: 2.0.2 - - "<" - !ruby/object:Gem::Version - version: '5.0' + version: '6.0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement @@ -29,7 +29,7 @@ version: 2.0.2 - - "<" - !ruby/object:Gem::Version - version: '5.0' + version: '6.0' - !ruby/object:Gem::Dependency name: bundler requirement: !ruby/object:Gem::Requirement @@ -65,7 +65,6 @@ - LICENSE.txt - README.md - Rakefile -- addressable.gemspec - data/unicode.data - lib/addressable.rb - lib/addressable/idna.rb @@ -90,8 +89,9 @@ homepage: https://github.com/sporkmonger/addressable licenses: - Apache-2.0 -metadata: {} -post_install_message: +metadata: + changelog_uri: https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md +post_install_message: rdoc_options: - "--main" - README.md @@ -101,15 +101,15 @@ requirements: - - ">=" - !ruby/object:Gem::Version - version: '2.0' + version: '2.2' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.0.3 -signing_key: +rubygems_version: 3.3.7 +signing_key: specification_version: 4 summary: URI Implementation test_files: [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/addressable/idna_spec.rb new/spec/addressable/idna_spec.rb --- old/spec/addressable/idna_spec.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/spec/addressable/idna_spec.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# coding: utf-8 # Copyright (C) Bob Aman # # Licensed under the Apache License, Version 2.0 (the "License"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/addressable/net_http_compat_spec.rb new/spec/addressable/net_http_compat_spec.rb --- old/spec/addressable/net_http_compat_spec.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/spec/addressable/net_http_compat_spec.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# coding: utf-8 # Copyright (C) Bob Aman # # Licensed under the Apache License, Version 2.0 (the "License"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/addressable/security_spec.rb new/spec/addressable/security_spec.rb --- old/spec/addressable/security_spec.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/spec/addressable/security_spec.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# coding: utf-8 # Copyright (C) Bob Aman # # Licensed under the Apache License, Version 2.0 (the "License"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/addressable/template_spec.rb new/spec/addressable/template_spec.rb --- old/spec/addressable/template_spec.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/spec/addressable/template_spec.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# coding: utf-8 # Copyright (C) Bob Aman # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -78,6 +77,15 @@ end end +describe "#to_regexp" do + it "does not match the first line of multiline strings" do + uri = "https://www.example.com/bar" + template = Addressable::Template.new(uri) + expect(template.match(uri)).not_to be_nil + expect(template.match("#{uri}\ngarbage")).to be_nil + end +end + describe "Type conversion" do subject { { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/addressable/uri_spec.rb new/spec/addressable/uri_spec.rb --- old/spec/addressable/uri_spec.rb 2021-07-03 06:27:42.000000000 +0200 +++ new/spec/addressable/uri_spec.rb 2022-08-19 12:48:27.000000000 +0200 @@ -1,6 +1,5 @@ # frozen_string_literal: true -# coding: utf-8 # Copyright (C) Bob Aman # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -999,6 +998,72 @@ end end +describe Addressable::URI, "when normalized and then deeply frozen" do + before do + @uri = Addressable::URI.parse( + "http://user:passw...@example.com:8080/path?query=value#fragment" + ).normalize! + + @uri.instance_variables.each do |var| + @uri.instance_variable_set(var, @uri.instance_variable_get(var).freeze) + end + + @uri.freeze + end + + it "#normalized_scheme should not error" do + expect { @uri.normalized_scheme }.not_to raise_error + end + + it "#normalized_user should not error" do + expect { @uri.normalized_user }.not_to raise_error + end + + it "#normalized_password should not error" do + expect { @uri.normalized_password }.not_to raise_error + end + + it "#normalized_userinfo should not error" do + expect { @uri.normalized_userinfo }.not_to raise_error + end + + it "#normalized_host should not error" do + expect { @uri.normalized_host }.not_to raise_error + end + + it "#normalized_authority should not error" do + expect { @uri.normalized_authority }.not_to raise_error + end + + it "#normalized_port should not error" do + expect { @uri.normalized_port }.not_to raise_error + end + + it "#normalized_site should not error" do + expect { @uri.normalized_site }.not_to raise_error + end + + it "#normalized_path should not error" do + expect { @uri.normalized_path }.not_to raise_error + end + + it "#normalized_query should not error" do + expect { @uri.normalized_query }.not_to raise_error + end + + it "#normalized_fragment should not error" do + expect { @uri.normalized_fragment }.not_to raise_error + end + + it "should be frozen" do + expect(@uri).to be_frozen + end + + it "should not allow destructive operations" do + expect { @uri.normalize! }.to raise_error(RuntimeError) + end +end + describe Addressable::URI, "when created from string components" do before do @uri = Addressable::URI.new( @@ -5993,6 +6058,11 @@ expect(Addressable::URI.unencode_component("ski=%BA%DA??")).to eq("ski=\xBA\xDA??") end + it "should not fail with UTF-8 incompatible string" do + url = "/M%E9/\xE9?p=\xFC".b + expect(Addressable::URI.unencode_component(url)).to eq("/M\xE9/\xE9?p=\xFC") + end + it "should result in correct percent encoded sequence as a URI" do expect(Addressable::URI.unencode( "/path?g%C3%BCnther", ::Addressable::URI @@ -6663,3 +6733,13 @@ expect(@uri.class).to eq(@uri.join('path').class) end end + +describe Addressable::URI, "when initialized in a non-main `Ractor`" do + it "should have the same value as if used in the main `Ractor`" do + pending("Ruby 3.0+ for `Ractor` support") unless defined?(Ractor) + main = Addressable::URI.parse("http://example.com") + expect( + Ractor.new { Addressable::URI.parse("http://example.com") }.take + ).to eq(main) + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/tasks/gem.rake new/tasks/gem.rake --- old/tasks/gem.rake 2021-07-03 06:27:42.000000000 +0200 +++ new/tasks/gem.rake 2022-08-19 12:48:27.000000000 +0200 @@ -19,9 +19,9 @@ exit(1) end - s.required_ruby_version = ">= 2.0" + s.required_ruby_version = ">= 2.2" - s.add_runtime_dependency "public_suffix", ">= 2.0.2", "< 5.0" + s.add_runtime_dependency "public_suffix", ">= 2.0.2", "< 6.0" s.add_development_dependency "bundler", ">= 1.0", "< 3.0" s.require_path = "lib" @@ -30,6 +30,9 @@ s.email = "b...@sporkmonger.com" s.homepage = "https://github.com/sporkmonger/addressable" s.license = "Apache-2.0" + s.metadata = { + "changelog_uri" => "https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md" + } end Gem::PackageTask.new(GEM_SPEC) do |p|