This commit is contained in:
@@ -0,0 +1,326 @@
|
||||
# Changelog
|
||||
|
||||
## Addressable 2.9.0 <a name="v2.9.0">
|
||||
- fixes ReDoS vulnerability in Addressable::Template#match (fixes incomplete
|
||||
remediation in 2.8.10)
|
||||
|
||||
## Addressable 2.8.10 <a name="v2.8.10">
|
||||
- fixes ReDoS vulnerability in Addressable::Template#match
|
||||
|
||||
## Addressable 2.8.9 <a name="v2.8.9">
|
||||
- Reduce gem size by excluding test files ([#569])
|
||||
- No need for bundler as development dependency ([#571], [5fc1d93](https://github.com/sporkmonger/addressable/commit/5fc1d93))
|
||||
- idna/pure: stop building the useless `COMPOSITION_TABLE` (removes the `Addressable::IDNA::COMPOSITION_TABLE` constant) ([#564])
|
||||
|
||||
[#569]: https://github.com/sporkmonger/addressable/pull/569
|
||||
[#571]: https://github.com/sporkmonger/addressable/pull/571
|
||||
[#564]: https://github.com/sporkmonger/addressable/pull/564
|
||||
|
||||
## Addressable 2.8.8 <a name="v2.8.8">
|
||||
- Replace the `unicode.data` blob by a ruby constant ([#561])
|
||||
- Allow `public_suffix` 7 ([#558])
|
||||
|
||||
[#561]: https://github.com/sporkmonger/addressable/pull/561
|
||||
[#558]: https://github.com/sporkmonger/addressable/pull/558
|
||||
|
||||
## Addressable 2.8.7 <a name="v2.8.7">
|
||||
- Allow `public_suffix` 6 ([#535])
|
||||
|
||||
[#535]: https://github.com/sporkmonger/addressable/pull/535
|
||||
|
||||
## Addressable 2.8.6 <a name="v2.8.6">
|
||||
- Memoize regexps for common character classes ([#524])
|
||||
|
||||
[#524]: https://github.com/sporkmonger/addressable/pull/524
|
||||
|
||||
## Addressable 2.8.5 <a name="v2.8.5">
|
||||
- Fix thread safety issue with encoding tables ([#515])
|
||||
- Define URI::NONE as a module to avoid serialization issues ([#509])
|
||||
- Fix YAML serialization ([#508])
|
||||
|
||||
[#508]: https://github.com/sporkmonger/addressable/pull/508
|
||||
[#509]: https://github.com/sporkmonger/addressable/pull/509
|
||||
[#515]: https://github.com/sporkmonger/addressable/pull/515
|
||||
|
||||
## Addressable 2.8.4 <a name="v2.8.4">
|
||||
- Restore `Addressable::IDNA.unicode_normalize_kc` as a deprecated method ([#504])
|
||||
|
||||
[#504]: https://github.com/sporkmonger/addressable/pull/504
|
||||
|
||||
## Addressable 2.8.3 <a name="v2.8.3">
|
||||
- Fix template expand level 2 hash support for non-string objects ([#499], [#498])
|
||||
|
||||
[#499]: https://github.com/sporkmonger/addressable/pull/499
|
||||
[#498]: https://github.com/sporkmonger/addressable/pull/498
|
||||
|
||||
## Addressable 2.8.2 <a name="v2.8.2">
|
||||
- Improve cache hits and JIT friendliness ([#486](https://github.com/sporkmonger/addressable/pull/486))
|
||||
- Improve code style and test coverage ([#482](https://github.com/sporkmonger/addressable/pull/482))
|
||||
- Ensure reset of deferred validation ([#481](https://github.com/sporkmonger/addressable/pull/481))
|
||||
- Resolve normalization differences between `IDNA::Native` and `IDNA::Pure` ([#408](https://github.com/sporkmonger/addressable/issues/408), [#492])
|
||||
- Remove redundant colon in `Addressable::URI::CharacterClasses::AUTHORITY` regex ([#438](https://github.com/sporkmonger/addressable/pull/438)) (accidentally reverted by [#449] merge but [added back](https://github.com/sporkmonger/addressable/pull/492#discussion_r1105125280) in [#492])
|
||||
|
||||
[#492]: https://github.com/sporkmonger/addressable/pull/492
|
||||
|
||||
## Addressable 2.8.1 <a name="v2.8.1">
|
||||
- refactor `Addressable::URI.normalize_path` to address linter offenses ([#430](https://github.com/sporkmonger/addressable/pull/430))
|
||||
- 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])
|
||||
- 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))
|
||||
|
||||
[#449]: https://github.com/sporkmonger/addressable/pull/449
|
||||
[#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 <a name="v2.8.0">
|
||||
- fixes ReDoS vulnerability in Addressable::Template#match
|
||||
- no longer replaces `+` with spaces in queries for non-http(s) schemes
|
||||
- fixed encoding ipv6 literals
|
||||
- the `:compacted` flag for `normalized_query` now dedupes parameters
|
||||
- fix broken `escape_component` alias
|
||||
- dropping support for Ruby 2.0 and 2.1
|
||||
- adding Ruby 3.0 compatibility for development tasks
|
||||
- drop support for `rack-mount` and remove Addressable::Template#generate
|
||||
- performance improvements
|
||||
- switch CI/CD to GitHub Actions
|
||||
|
||||
## Addressable 2.7.0 <a name="v2.7.0">
|
||||
- added `:compacted` flag to `normalized_query`
|
||||
- `heuristic_parse` handles `mailto:` more intuitively
|
||||
- dropped explicit support for JRuby 9.0.5.0
|
||||
- compatibility w/ public_suffix 4.x
|
||||
- performance improvements
|
||||
|
||||
## Addressable 2.6.0 <a name="v2.6.0">
|
||||
- added `tld=` method to allow assignment to the public suffix
|
||||
- most `heuristic_parse` patterns are now case-insensitive
|
||||
- `heuristic_parse` handles more `file://` URI variations
|
||||
- fixes bug in `heuristic_parse` when uri starts with digit
|
||||
- fixes bug in `request_uri=` with query strings
|
||||
- fixes template issues with `nil` and `?` operator
|
||||
- `frozen_string_literal` pragmas added
|
||||
- minor performance improvements in regexps
|
||||
- fixes to eliminate warnings
|
||||
|
||||
## Addressable 2.5.2 <a name="v2.5.2">
|
||||
- better support for frozen string literals
|
||||
- fixed bug w/ uppercase characters in scheme
|
||||
- IDNA errors w/ emoji URLs
|
||||
- compatibility w/ public_suffix 3.x
|
||||
|
||||
## Addressable 2.5.1 <a name="v2.5.1">
|
||||
- allow unicode normalization to be disabled for URI Template expansion
|
||||
- removed duplicate test
|
||||
|
||||
## Addressable 2.5.0 <a name="v2.5.0">
|
||||
- dropping support for Ruby 1.9
|
||||
- adding support for Ruby 2.4 preview
|
||||
- add support for public suffixes and tld; first runtime dependency
|
||||
- hostname escaping should match RFC; underscores in hostnames no longer escaped
|
||||
- paths beginning with // and missing an authority are now considered invalid
|
||||
- validation now also takes place after setting a path
|
||||
- handle backslashes in authority more like a browser for `heuristic_parse`
|
||||
- unescaped backslashes in host now raise an `InvalidURIError`
|
||||
- `merge!`, `join!`, `omit!` and `normalize!` don't disable deferred validation
|
||||
- `heuristic_parse` now trims whitespace before parsing
|
||||
- host parts longer than 63 bytes will be ignored and not passed to libidn
|
||||
- normalized values always encoded as UTF-8
|
||||
|
||||
## Addressable 2.4.0 <a name="v2.4.0">
|
||||
- support for 1.8.x dropped
|
||||
- double quotes in a host now raises an error
|
||||
- newlines in host will no longer get unescaped during normalization
|
||||
- stricter handling of bogus scheme values
|
||||
- stricter handling of encoded port values
|
||||
- calling `require 'addressable'` will now load both the URI and Template files
|
||||
- assigning to the `hostname` component with an `IPAddr` object is now supported
|
||||
- assigning to the `origin` component is now supported
|
||||
- fixed minor bug where an exception would be thrown for a missing ACE suffix
|
||||
- better partial expansion of URI templates
|
||||
|
||||
## Addressable 2.3.8 <a name="v2.3.8">
|
||||
- fix warnings
|
||||
- update dependency gems
|
||||
- support for 1.8.x officially deprecated
|
||||
|
||||
## Addressable 2.3.7 <a name="v2.3.7">
|
||||
- fix scenario in which invalid URIs don't get an exception until inspected
|
||||
- handle hostnames with two adjacent periods correctly
|
||||
- upgrade of RSpec
|
||||
|
||||
## Addressable 2.3.6 <a name="v2.3.6">
|
||||
- normalization drops empty query string
|
||||
- better handling in template extract for missing values
|
||||
- template modifier for `'?'` now treated as optional
|
||||
- fixed issue where character class parameters were modified
|
||||
- templates can now be tested for equality
|
||||
- added `:sorted` option to normalization of query strings
|
||||
- fixed issue with normalization of hosts given in `'example.com.'` form
|
||||
|
||||
## Addressable 2.3.5 <a name="v2.3.5">
|
||||
- added Addressable::URI#empty? method
|
||||
- Addressable::URI#hostname methods now strip square brackets from IPv6 hosts
|
||||
- compatibility with Net::HTTP in Ruby 2.0.0
|
||||
- Addressable::URI#route_from should always give relative URIs
|
||||
|
||||
## Addressable 2.3.4 <a name="v2.3.4">
|
||||
- fixed issue with encoding altering its inputs
|
||||
- query string normalization now leaves ';' characters alone
|
||||
- FakeFS is detected before attempting to load unicode tables
|
||||
- additional testing to ensure frozen objects don't cause problems
|
||||
|
||||
## Addressable 2.3.3 <a name="v2.3.3">
|
||||
- fixed issue with converting common primitives during template expansion
|
||||
- fixed port encoding issue
|
||||
- removed a few warnings
|
||||
- normalize should now ignore %2B in query strings
|
||||
- the IDNA logic should now be handled by libidn in Ruby 1.9
|
||||
- no template match should now result in nil instead of an empty MatchData
|
||||
- added license information to gemspec
|
||||
|
||||
## Addressable 2.3.2 <a name="v2.3.2">
|
||||
- added Addressable::URI#default_port method
|
||||
- fixed issue with Marshalling Unicode data on Windows
|
||||
- improved heuristic parsing to better handle IPv4 addresses
|
||||
|
||||
## Addressable 2.3.1 <a name="v2.3.1">
|
||||
- fixed missing unicode data file
|
||||
|
||||
## Addressable 2.3.0 <a name="v2.3.0">
|
||||
- updated Addressable::Template to use RFC 6570, level 4
|
||||
- fixed compatibility problems with some versions of Ruby
|
||||
- moved unicode tables into a data file for performance reasons
|
||||
- removing support for multiple query value notations
|
||||
|
||||
## Addressable 2.2.8 <a name="v2.2.8">
|
||||
- fixed issues with dot segment removal code
|
||||
- form encoding can now handle multiple values per key
|
||||
- updated development environment
|
||||
|
||||
## Addressable 2.2.7 <a name="v2.2.7">
|
||||
- fixed issues related to Addressable::URI#query_values=
|
||||
- the Addressable::URI.parse method is now polymorphic
|
||||
|
||||
## Addressable 2.2.6 <a name="v2.2.6">
|
||||
- changed the way ambiguous paths are handled
|
||||
- fixed bug with frozen URIs
|
||||
- https supported in heuristic parsing
|
||||
|
||||
## Addressable 2.2.5 <a name="v2.2.5">
|
||||
- 'parsing' a pre-parsed URI object is now a dup operation
|
||||
- introduced conditional support for libidn
|
||||
- fixed normalization issue on ampersands in query strings
|
||||
- added additional tests around handling of query strings
|
||||
|
||||
## Addressable 2.2.4 <a name="v2.2.4">
|
||||
- added origin support from draft-ietf-websec-origin-00
|
||||
- resolved issue with attempting to navigate below root
|
||||
- fixed bug with string splitting in query strings
|
||||
|
||||
## Addressable 2.2.3 <a name="v2.2.3">
|
||||
- added :flat_array notation for query strings
|
||||
|
||||
## Addressable 2.2.2 <a name="v2.2.2">
|
||||
- fixed issue with percent escaping of '+' character in query strings
|
||||
|
||||
## Addressable 2.2.1 <a name="v2.2.1">
|
||||
- added support for application/x-www-form-urlencoded.
|
||||
|
||||
## Addressable 2.2.0 <a name="v2.2.0">
|
||||
- added site methods
|
||||
- improved documentation
|
||||
|
||||
## Addressable 2.1.2 <a name="v2.1.2">
|
||||
- added HTTP request URI methods
|
||||
- better handling of Windows file paths
|
||||
- validation_deferred boolean replaced with defer_validation block
|
||||
- normalization of percent-encoded paths should now be correct
|
||||
- fixed issue with constructing URIs with relative paths
|
||||
- fixed warnings
|
||||
|
||||
## Addressable 2.1.1 <a name="v2.1.1">
|
||||
- more type checking changes
|
||||
- fixed issue with unicode normalization
|
||||
- added method to find template defaults
|
||||
- symbolic keys are now allowed in template mappings
|
||||
- numeric values and symbolic values are now allowed in template mappings
|
||||
|
||||
## Addressable 2.1.0 <a name="v2.1.0x">
|
||||
- refactored URI template support out into its own class
|
||||
- removed extract method due to being useless and unreliable
|
||||
- removed Addressable::URI.expand_template
|
||||
- removed Addressable::URI#extract_mapping
|
||||
- added partial template expansion
|
||||
- fixed minor bugs in the parse and heuristic_parse methods
|
||||
- fixed incompatibility with Ruby 1.9.1
|
||||
- fixed bottleneck in Addressable::URI#hash and Addressable::URI#to_s
|
||||
- fixed unicode normalization exception
|
||||
- updated query_values methods to better handle subscript notation
|
||||
- worked around issue with freezing URIs
|
||||
- improved specs
|
||||
|
||||
## Addressable 2.0.2 <a name="v2.0.2">
|
||||
- fixed issue with URI template expansion
|
||||
- fixed issue with percent escaping characters 0-15
|
||||
|
||||
## Addressable 2.0.1 <a name="v2.0.1">
|
||||
- fixed issue with query string assignment
|
||||
- fixed issue with improperly encoded components
|
||||
|
||||
## Addressable 2.0.0 <a name="v2.0.0">
|
||||
- the initialize method now takes an options hash as its only parameter
|
||||
- added query_values method to URI class
|
||||
- completely replaced IDNA implementation with pure Ruby
|
||||
- renamed Addressable::ADDRESSABLE_VERSION to Addressable::VERSION
|
||||
- completely reworked the Rakefile
|
||||
- changed the behavior of the port method significantly
|
||||
- Addressable::URI.encode_segment, Addressable::URI.unencode_segment renamed
|
||||
- documentation is now in YARD format
|
||||
- more rigorous type checking
|
||||
- to_str method implemented, implicit conversion to Strings now allowed
|
||||
- Addressable::URI#omit method added, Addressable::URI#merge method replaced
|
||||
- updated URI Template code to match v 03 of the draft spec
|
||||
- added a bunch of new specifications
|
||||
|
||||
## Addressable 1.0.4 <a name="v1.0.4">
|
||||
- switched to using RSpec's pending system for specs that rely on IDN
|
||||
- fixed issue with creating URIs with paths that are not prefixed with '/'
|
||||
|
||||
## Addressable 1.0.3 <a name="v1.0.3">
|
||||
- implemented a hash method
|
||||
|
||||
## Addressable 1.0.2 <a name="v1.0.2">
|
||||
- fixed minor bug with the extract_mapping method
|
||||
|
||||
## Addressable 1.0.1 <a name="v1.0.1">
|
||||
- fixed minor bug with the extract_mapping method
|
||||
|
||||
## Addressable 1.0.0 <a name="v1.0.0">
|
||||
- heuristic parse method added
|
||||
- parsing is slightly more strict
|
||||
- replaced to_h with to_hash
|
||||
- fixed routing methods
|
||||
- improved specifications
|
||||
- improved heckle rake task
|
||||
- no surviving heckle mutations
|
||||
|
||||
## Addressable 0.1.2 <a name="v0.1.2">
|
||||
- improved normalization
|
||||
- fixed bug in joining algorithm
|
||||
- updated specifications
|
||||
|
||||
## Addressable 0.1.1 <a name="v0.1.1">
|
||||
- updated documentation
|
||||
- added URI Template variable extraction
|
||||
|
||||
## Addressable 0.1.0 <a name="v0.1.0">
|
||||
- initial release
|
||||
- implementation based on RFC 3986, 3987
|
||||
- support for IRIs via libidn
|
||||
- support for the URI Template draft spec
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,121 @@
|
||||
# Addressable
|
||||
|
||||
<dl>
|
||||
<dt>Homepage</dt><dd><a href="https://github.com/sporkmonger/addressable">github.com/sporkmonger/addressable</a></dd>
|
||||
<dt>Author</dt><dd><a href="mailto:bob@sporkmonger.com">Bob Aman</a></dd>
|
||||
<dt>Copyright</dt><dd>Copyright © Bob Aman</dd>
|
||||
<dt>License</dt><dd>Apache 2.0</dd>
|
||||
</dl>
|
||||
|
||||
[][gem]
|
||||
[][actions]
|
||||
[][coveralls]
|
||||
[][inch]
|
||||
|
||||
[gem]: https://rubygems.org/gems/addressable
|
||||
[actions]: https://github.com/sporkmonger/addressable/actions
|
||||
[coveralls]: https://coveralls.io/r/sporkmonger/addressable
|
||||
[inch]: https://inch-ci.org/github/sporkmonger/addressable
|
||||
|
||||
## Description
|
||||
|
||||
Addressable is an alternative implementation to the URI implementation
|
||||
that is part of Ruby's standard library. It is flexible, offers heuristic
|
||||
parsing, and additionally provides extensive support for IRIs and URI templates.
|
||||
|
||||
Addressable closely conforms to RFC 3986, RFC 3987, and RFC 6570 (level 4).
|
||||
|
||||
## Reference
|
||||
|
||||
- {Addressable::URI}
|
||||
- {Addressable::Template}
|
||||
|
||||
## Example usage
|
||||
|
||||
```ruby
|
||||
require "addressable/uri"
|
||||
|
||||
uri = Addressable::URI.parse("http://example.com/path/to/resource/")
|
||||
uri.scheme
|
||||
#=> "http"
|
||||
uri.host
|
||||
#=> "example.com"
|
||||
uri.path
|
||||
#=> "/path/to/resource/"
|
||||
|
||||
uri = Addressable::URI.parse("http://www.詹姆斯.com/")
|
||||
uri.normalize
|
||||
#=> #<Addressable::URI:0xc9a4c8 URI:http://www.xn--8ws00zhy3a.com/>
|
||||
```
|
||||
|
||||
|
||||
## URI Templates
|
||||
|
||||
For more details, see [RFC 6570](https://www.rfc-editor.org/rfc/rfc6570.txt).
|
||||
|
||||
|
||||
```ruby
|
||||
|
||||
require "addressable/template"
|
||||
|
||||
template = Addressable::Template.new("http://example.com/{?query*}")
|
||||
template.expand({
|
||||
"query" => {
|
||||
'foo' => 'bar',
|
||||
'color' => 'red'
|
||||
}
|
||||
})
|
||||
#=> #<Addressable::URI:0xc9d95c URI:http://example.com/?foo=bar&color=red>
|
||||
|
||||
template = Addressable::Template.new("http://example.com/{?one,two,three}")
|
||||
template.partial_expand({"one" => "1", "three" => 3}).pattern
|
||||
#=> "http://example.com/?one=1{&two}&three=3"
|
||||
|
||||
template = Addressable::Template.new(
|
||||
"http://{host}{/segments*}/{?one,two,bogus}{#fragment}"
|
||||
)
|
||||
uri = Addressable::URI.parse(
|
||||
"http://example.com/a/b/c/?one=1&two=2#foo"
|
||||
)
|
||||
template.extract(uri)
|
||||
#=>
|
||||
# {
|
||||
# "host" => "example.com",
|
||||
# "segments" => ["a", "b", "c"],
|
||||
# "one" => "1",
|
||||
# "two" => "2",
|
||||
# "fragment" => "foo"
|
||||
# }
|
||||
```
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ gem install addressable
|
||||
```
|
||||
|
||||
You may optionally turn on native IDN support by installing libidn and the
|
||||
idn gem:
|
||||
|
||||
```console
|
||||
$ sudo apt-get install libidn11-dev # Debian/Ubuntu
|
||||
$ brew install libidn # OS X
|
||||
$ gem install idn-ruby
|
||||
```
|
||||
|
||||
## Semantic Versioning
|
||||
|
||||
This project uses [Semantic Versioning](https://semver.org/). You can (and should) specify your
|
||||
dependency using a pessimistic version constraint covering the major and minor
|
||||
values:
|
||||
|
||||
```ruby
|
||||
spec.add_dependency 'addressable', '~> 2.7'
|
||||
```
|
||||
|
||||
If you need a specific bug fix, you can also specify minimum tiny versions
|
||||
without preventing updates to the latest minor release:
|
||||
|
||||
```ruby
|
||||
spec.add_dependency 'addressable', '~> 2.3', '>= 2.3.7'
|
||||
```
|
||||
@@ -0,0 +1,4 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'addressable/uri'
|
||||
require 'addressable/template'
|
||||
@@ -0,0 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#--
|
||||
# Copyright (C) Bob Aman
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#++
|
||||
|
||||
|
||||
begin
|
||||
require "addressable/idna/native"
|
||||
rescue LoadError
|
||||
# libidn or the idn gem was not available, fall back on a pure-Ruby
|
||||
# implementation...
|
||||
require "addressable/idna/pure"
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#--
|
||||
# Copyright (C) Bob Aman
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#++
|
||||
|
||||
|
||||
require "idn"
|
||||
|
||||
module Addressable
|
||||
module IDNA
|
||||
def self.punycode_encode(value)
|
||||
IDN::Punycode.encode(value.to_s)
|
||||
end
|
||||
|
||||
def self.punycode_decode(value)
|
||||
IDN::Punycode.decode(value.to_s)
|
||||
end
|
||||
|
||||
class << self
|
||||
# @deprecated Use {String#unicode_normalize(:nfkc)} instead
|
||||
def unicode_normalize_kc(value)
|
||||
value.to_s.unicode_normalize(:nfkc)
|
||||
end
|
||||
|
||||
extend Gem::Deprecate
|
||||
deprecate :unicode_normalize_kc, "String#unicode_normalize(:nfkc)", 2023, 4
|
||||
end
|
||||
|
||||
def self.to_ascii(value)
|
||||
value.to_s.split('.', -1).map do |segment|
|
||||
if segment.size > 0 && segment.size < 64
|
||||
IDN::Idna.toASCII(segment, IDN::Idna::ALLOW_UNASSIGNED)
|
||||
elsif segment.size >= 64
|
||||
segment
|
||||
else
|
||||
''
|
||||
end
|
||||
end.join('.')
|
||||
end
|
||||
|
||||
def self.to_unicode(value)
|
||||
value.to_s.split('.', -1).map do |segment|
|
||||
if segment.size > 0 && segment.size < 64
|
||||
IDN::Idna.toUnicode(segment, IDN::Idna::ALLOW_UNASSIGNED)
|
||||
elsif segment.size >= 64
|
||||
segment
|
||||
else
|
||||
''
|
||||
end
|
||||
end.join('.')
|
||||
end
|
||||
end
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
#--
|
||||
# Copyright (C) Bob Aman
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#++
|
||||
|
||||
|
||||
# Used to prevent the class/module from being loaded more than once
|
||||
if !defined?(Addressable::VERSION)
|
||||
module Addressable
|
||||
module VERSION
|
||||
MAJOR = 2
|
||||
MINOR = 9
|
||||
TINY = 0
|
||||
|
||||
STRING = [MAJOR, MINOR, TINY].join('.')
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user