addressable 2.5.0 → 2.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +138 -34
- data/Gemfile +15 -16
- data/README.md +20 -21
- data/Rakefile +16 -11
- data/addressable.gemspec +28 -0
- data/lib/addressable/idna/native.rb +12 -5
- data/lib/addressable/idna/pure.rb +4257 -214
- data/lib/addressable/idna.rb +2 -1
- data/lib/addressable/template.rb +76 -98
- data/lib/addressable/uri.rb +338 -228
- data/lib/addressable/version.rb +4 -3
- data/lib/addressable.rb +2 -0
- data/spec/addressable/idna_spec.rb +29 -13
- data/spec/addressable/net_http_compat_spec.rb +2 -1
- data/spec/addressable/security_spec.rb +2 -1
- data/spec/addressable/template_spec.rb +144 -267
- data/spec/addressable/uri_spec.rb +598 -216
- data/spec/spec_helper.rb +12 -0
- data/tasks/clobber.rake +2 -0
- data/tasks/gem.rake +18 -9
- data/tasks/git.rake +2 -0
- data/tasks/metrics.rake +2 -0
- data/tasks/profile.rake +72 -0
- data/tasks/rspec.rake +3 -1
- data/tasks/yard.rake +2 -0
- metadata +25 -22
- data/data/unicode.data +0 -0
- data/spec/addressable/rack_mount_compat_spec.rb +0 -104
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5ba707c598b13c65017d7e0087ab2a5d6e53b549a5dd8d6758bf9f44cd4ce089
|
|
4
|
+
data.tar.gz: 1001a3bd33c3338cb5506831fa2c81a858e4f7e4c3d630b1e5cf8db1bb787179
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3810b328b2868fdb3929e6e64ddc1a12a8c9f26e092b95ab582f0d2d52e436e960be1434e3608901d2d657fc86df03f91467383720c70304a3fdaeaa040a2a1c
|
|
7
|
+
data.tar.gz: 482415fe1a529fc5c43183bcd5d3673360d2886467435b8a8c8ed01ab3b8792265808f67704ce01b0d1af5d4888aaa75cc11af464bad70e0e78827f8b56f5cb5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,108 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Addressable 2.8.8 <a name="v2.8.8">
|
|
4
|
+
- Replace the `unicode.data` blob by a ruby constant ([#561])
|
|
5
|
+
- Allow `public_suffix` 7 ([#558])
|
|
6
|
+
|
|
7
|
+
[#561]: https://github.com/sporkmonger/addressable/pull/561
|
|
8
|
+
[#535]: https://github.com/sporkmonger/addressable/pull/558
|
|
9
|
+
|
|
10
|
+
## Addressable 2.8.7 <a name="v2.8.7">
|
|
11
|
+
- Allow `public_suffix` 6 ([#535])
|
|
12
|
+
|
|
13
|
+
[#535]: https://github.com/sporkmonger/addressable/pull/535
|
|
14
|
+
|
|
15
|
+
## Addressable 2.8.6 <a name="v2.8.6">
|
|
16
|
+
- Memoize regexps for common character classes ([#524])
|
|
17
|
+
|
|
18
|
+
[#524]: https://github.com/sporkmonger/addressable/pull/524
|
|
19
|
+
|
|
20
|
+
## Addressable 2.8.5 <a name="v2.8.5">
|
|
21
|
+
- Fix thread safety issue with encoding tables ([#515])
|
|
22
|
+
- Define URI::NONE as a module to avoid serialization issues ([#509])
|
|
23
|
+
- Fix YAML serialization ([#508])
|
|
24
|
+
|
|
25
|
+
[#508]: https://github.com/sporkmonger/addressable/pull/508
|
|
26
|
+
[#509]: https://github.com/sporkmonger/addressable/pull/509
|
|
27
|
+
[#515]: https://github.com/sporkmonger/addressable/pull/515
|
|
28
|
+
|
|
29
|
+
## Addressable 2.8.4 <a name="v2.8.4">
|
|
30
|
+
- Restore `Addressable::IDNA.unicode_normalize_kc` as a deprecated method ([#504])
|
|
31
|
+
|
|
32
|
+
[#504]: https://github.com/sporkmonger/addressable/pull/504
|
|
33
|
+
|
|
34
|
+
## Addressable 2.8.3 <a name="v2.8.3">
|
|
35
|
+
- Fix template expand level 2 hash support for non-string objects ([#499], [#498])
|
|
36
|
+
|
|
37
|
+
[#499]: https://github.com/sporkmonger/addressable/pull/499
|
|
38
|
+
[#498]: https://github.com/sporkmonger/addressable/pull/498
|
|
39
|
+
|
|
40
|
+
## Addressable 2.8.2 <a name="v2.8.2">
|
|
41
|
+
- Improve cache hits and JIT friendliness ([#486](https://github.com/sporkmonger/addressable/pull/486))
|
|
42
|
+
- Improve code style and test coverage ([#482](https://github.com/sporkmonger/addressable/pull/482))
|
|
43
|
+
- Ensure reset of deferred validation ([#481](https://github.com/sporkmonger/addressable/pull/481))
|
|
44
|
+
- Resolve normalization differences between `IDNA::Native` and `IDNA::Pure` ([#408](https://github.com/sporkmonger/addressable/issues/408), [#492])
|
|
45
|
+
- 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])
|
|
46
|
+
|
|
47
|
+
[#492]: https://github.com/sporkmonger/addressable/pull/492
|
|
48
|
+
|
|
49
|
+
## Addressable 2.8.1 <a name="v2.8.1">
|
|
50
|
+
- refactor `Addressable::URI.normalize_path` to address linter offenses ([#430](https://github.com/sporkmonger/addressable/pull/430))
|
|
51
|
+
- update gemspec to reflect supported Ruby versions ([#466], [#464], [#463])
|
|
52
|
+
- compatibility w/ public_suffix 5.x ([#466], [#465], [#460])
|
|
53
|
+
- fixes "invalid byte sequence in UTF-8" exception when unencoding URLs containing non UTF-8 characters ([#459](https://github.com/sporkmonger/addressable/pull/459))
|
|
54
|
+
- `Ractor` compatibility ([#449])
|
|
55
|
+
- use the whole string instead of a single line for template match ([#431](https://github.com/sporkmonger/addressable/pull/431))
|
|
56
|
+
- force UTF-8 encoding only if needed ([#341](https://github.com/sporkmonger/addressable/pull/341))
|
|
57
|
+
|
|
58
|
+
[#449]: https://github.com/sporkmonger/addressable/pull/449
|
|
59
|
+
[#460]: https://github.com/sporkmonger/addressable/pull/460
|
|
60
|
+
[#463]: https://github.com/sporkmonger/addressable/pull/463
|
|
61
|
+
[#464]: https://github.com/sporkmonger/addressable/pull/464
|
|
62
|
+
[#465]: https://github.com/sporkmonger/addressable/pull/465
|
|
63
|
+
[#466]: https://github.com/sporkmonger/addressable/pull/466
|
|
64
|
+
|
|
65
|
+
## Addressable 2.8.0 <a name="v2.8.0">
|
|
66
|
+
- fixes ReDoS vulnerability in Addressable::Template#match
|
|
67
|
+
- no longer replaces `+` with spaces in queries for non-http(s) schemes
|
|
68
|
+
- fixed encoding ipv6 literals
|
|
69
|
+
- the `:compacted` flag for `normalized_query` now dedupes parameters
|
|
70
|
+
- fix broken `escape_component` alias
|
|
71
|
+
- dropping support for Ruby 2.0 and 2.1
|
|
72
|
+
- adding Ruby 3.0 compatibility for development tasks
|
|
73
|
+
- drop support for `rack-mount` and remove Addressable::Template#generate
|
|
74
|
+
- performance improvements
|
|
75
|
+
- switch CI/CD to GitHub Actions
|
|
76
|
+
|
|
77
|
+
## Addressable 2.7.0 <a name="v2.7.0">
|
|
78
|
+
- added `:compacted` flag to `normalized_query`
|
|
79
|
+
- `heuristic_parse` handles `mailto:` more intuitively
|
|
80
|
+
- dropped explicit support for JRuby 9.0.5.0
|
|
81
|
+
- compatibility w/ public_suffix 4.x
|
|
82
|
+
- performance improvements
|
|
83
|
+
|
|
84
|
+
## Addressable 2.6.0 <a name="v2.6.0">
|
|
85
|
+
- added `tld=` method to allow assignment to the public suffix
|
|
86
|
+
- most `heuristic_parse` patterns are now case-insensitive
|
|
87
|
+
- `heuristic_parse` handles more `file://` URI variations
|
|
88
|
+
- fixes bug in `heuristic_parse` when uri starts with digit
|
|
89
|
+
- fixes bug in `request_uri=` with query strings
|
|
90
|
+
- fixes template issues with `nil` and `?` operator
|
|
91
|
+
- `frozen_string_literal` pragmas added
|
|
92
|
+
- minor performance improvements in regexps
|
|
93
|
+
- fixes to eliminate warnings
|
|
94
|
+
|
|
95
|
+
## Addressable 2.5.2 <a name="v2.5.2">
|
|
96
|
+
- better support for frozen string literals
|
|
97
|
+
- fixed bug w/ uppercase characters in scheme
|
|
98
|
+
- IDNA errors w/ emoji URLs
|
|
99
|
+
- compatibility w/ public_suffix 3.x
|
|
100
|
+
|
|
101
|
+
## Addressable 2.5.1 <a name="v2.5.1">
|
|
102
|
+
- allow unicode normalization to be disabled for URI Template expansion
|
|
103
|
+
- removed duplicate test
|
|
104
|
+
|
|
105
|
+
## Addressable 2.5.0 <a name="v2.5.0">
|
|
2
106
|
- dropping support for Ruby 1.9
|
|
3
107
|
- adding support for Ruby 2.4 preview
|
|
4
108
|
- add support for public suffixes and tld; first runtime dependency
|
|
@@ -12,7 +116,7 @@
|
|
|
12
116
|
- host parts longer than 63 bytes will be ignored and not passed to libidn
|
|
13
117
|
- normalized values always encoded as UTF-8
|
|
14
118
|
|
|
15
|
-
|
|
119
|
+
## Addressable 2.4.0 <a name="v2.4.0">
|
|
16
120
|
- support for 1.8.x dropped
|
|
17
121
|
- double quotes in a host now raises an error
|
|
18
122
|
- newlines in host will no longer get unescaped during normalization
|
|
@@ -24,17 +128,17 @@
|
|
|
24
128
|
- fixed minor bug where an exception would be thrown for a missing ACE suffix
|
|
25
129
|
- better partial expansion of URI templates
|
|
26
130
|
|
|
27
|
-
|
|
131
|
+
## Addressable 2.3.8 <a name="v2.3.8">
|
|
28
132
|
- fix warnings
|
|
29
133
|
- update dependency gems
|
|
30
134
|
- support for 1.8.x officially deprecated
|
|
31
135
|
|
|
32
|
-
|
|
136
|
+
## Addressable 2.3.7 <a name="v2.3.7">
|
|
33
137
|
- fix scenario in which invalid URIs don't get an exception until inspected
|
|
34
138
|
- handle hostnames with two adjacent periods correctly
|
|
35
139
|
- upgrade of RSpec
|
|
36
140
|
|
|
37
|
-
|
|
141
|
+
## Addressable 2.3.6 <a name="v2.3.6">
|
|
38
142
|
- normalization drops empty query string
|
|
39
143
|
- better handling in template extract for missing values
|
|
40
144
|
- template modifier for `'?'` now treated as optional
|
|
@@ -43,19 +147,19 @@
|
|
|
43
147
|
- added `:sorted` option to normalization of query strings
|
|
44
148
|
- fixed issue with normalization of hosts given in `'example.com.'` form
|
|
45
149
|
|
|
46
|
-
|
|
150
|
+
## Addressable 2.3.5 <a name="v2.3.5">
|
|
47
151
|
- added Addressable::URI#empty? method
|
|
48
152
|
- Addressable::URI#hostname methods now strip square brackets from IPv6 hosts
|
|
49
153
|
- compatibility with Net::HTTP in Ruby 2.0.0
|
|
50
154
|
- Addressable::URI#route_from should always give relative URIs
|
|
51
155
|
|
|
52
|
-
|
|
156
|
+
## Addressable 2.3.4 <a name="v2.3.4">
|
|
53
157
|
- fixed issue with encoding altering its inputs
|
|
54
158
|
- query string normalization now leaves ';' characters alone
|
|
55
159
|
- FakeFS is detected before attempting to load unicode tables
|
|
56
160
|
- additional testing to ensure frozen objects don't cause problems
|
|
57
161
|
|
|
58
|
-
|
|
162
|
+
## Addressable 2.3.3 <a name="v2.3.3">
|
|
59
163
|
- fixed issue with converting common primitives during template expansion
|
|
60
164
|
- fixed port encoding issue
|
|
61
165
|
- removed a few warnings
|
|
@@ -64,59 +168,59 @@
|
|
|
64
168
|
- no template match should now result in nil instead of an empty MatchData
|
|
65
169
|
- added license information to gemspec
|
|
66
170
|
|
|
67
|
-
|
|
171
|
+
## Addressable 2.3.2 <a name="v2.3.2">
|
|
68
172
|
- added Addressable::URI#default_port method
|
|
69
173
|
- fixed issue with Marshalling Unicode data on Windows
|
|
70
174
|
- improved heuristic parsing to better handle IPv4 addresses
|
|
71
175
|
|
|
72
|
-
|
|
176
|
+
## Addressable 2.3.1 <a name="v2.3.1">
|
|
73
177
|
- fixed missing unicode data file
|
|
74
178
|
|
|
75
|
-
|
|
179
|
+
## Addressable 2.3.0 <a name="v2.3.0">
|
|
76
180
|
- updated Addressable::Template to use RFC 6570, level 4
|
|
77
181
|
- fixed compatibility problems with some versions of Ruby
|
|
78
182
|
- moved unicode tables into a data file for performance reasons
|
|
79
183
|
- removing support for multiple query value notations
|
|
80
184
|
|
|
81
|
-
|
|
185
|
+
## Addressable 2.2.8 <a name="v2.2.8">
|
|
82
186
|
- fixed issues with dot segment removal code
|
|
83
187
|
- form encoding can now handle multiple values per key
|
|
84
188
|
- updated development environment
|
|
85
189
|
|
|
86
|
-
|
|
190
|
+
## Addressable 2.2.7 <a name="v2.2.7">
|
|
87
191
|
- fixed issues related to Addressable::URI#query_values=
|
|
88
192
|
- the Addressable::URI.parse method is now polymorphic
|
|
89
193
|
|
|
90
|
-
|
|
194
|
+
## Addressable 2.2.6 <a name="v2.2.6">
|
|
91
195
|
- changed the way ambiguous paths are handled
|
|
92
196
|
- fixed bug with frozen URIs
|
|
93
197
|
- https supported in heuristic parsing
|
|
94
198
|
|
|
95
|
-
|
|
199
|
+
## Addressable 2.2.5 <a name="v2.2.5">
|
|
96
200
|
- 'parsing' a pre-parsed URI object is now a dup operation
|
|
97
201
|
- introduced conditional support for libidn
|
|
98
202
|
- fixed normalization issue on ampersands in query strings
|
|
99
203
|
- added additional tests around handling of query strings
|
|
100
204
|
|
|
101
|
-
|
|
205
|
+
## Addressable 2.2.4 <a name="v2.2.4">
|
|
102
206
|
- added origin support from draft-ietf-websec-origin-00
|
|
103
207
|
- resolved issue with attempting to navigate below root
|
|
104
208
|
- fixed bug with string splitting in query strings
|
|
105
209
|
|
|
106
|
-
|
|
210
|
+
## Addressable 2.2.3 <a name="v2.2.3">
|
|
107
211
|
- added :flat_array notation for query strings
|
|
108
212
|
|
|
109
|
-
|
|
213
|
+
## Addressable 2.2.2 <a name="v2.2.2">
|
|
110
214
|
- fixed issue with percent escaping of '+' character in query strings
|
|
111
215
|
|
|
112
|
-
|
|
216
|
+
## Addressable 2.2.1 <a name="v2.2.1">
|
|
113
217
|
- added support for application/x-www-form-urlencoded.
|
|
114
218
|
|
|
115
|
-
|
|
219
|
+
## Addressable 2.2.0 <a name="v2.2.0">
|
|
116
220
|
- added site methods
|
|
117
221
|
- improved documentation
|
|
118
222
|
|
|
119
|
-
|
|
223
|
+
## Addressable 2.1.2 <a name="v2.1.2">
|
|
120
224
|
- added HTTP request URI methods
|
|
121
225
|
- better handling of Windows file paths
|
|
122
226
|
- validation_deferred boolean replaced with defer_validation block
|
|
@@ -124,14 +228,14 @@
|
|
|
124
228
|
- fixed issue with constructing URIs with relative paths
|
|
125
229
|
- fixed warnings
|
|
126
230
|
|
|
127
|
-
|
|
231
|
+
## Addressable 2.1.1 <a name="v2.1.1">
|
|
128
232
|
- more type checking changes
|
|
129
233
|
- fixed issue with unicode normalization
|
|
130
234
|
- added method to find template defaults
|
|
131
235
|
- symbolic keys are now allowed in template mappings
|
|
132
236
|
- numeric values and symbolic values are now allowed in template mappings
|
|
133
237
|
|
|
134
|
-
|
|
238
|
+
## Addressable 2.1.0 <a name="v2.1.0x">
|
|
135
239
|
- refactored URI template support out into its own class
|
|
136
240
|
- removed extract method due to being useless and unreliable
|
|
137
241
|
- removed Addressable::URI.expand_template
|
|
@@ -145,15 +249,15 @@
|
|
|
145
249
|
- worked around issue with freezing URIs
|
|
146
250
|
- improved specs
|
|
147
251
|
|
|
148
|
-
|
|
252
|
+
## Addressable 2.0.2 <a name="v2.0.2">
|
|
149
253
|
- fixed issue with URI template expansion
|
|
150
254
|
- fixed issue with percent escaping characters 0-15
|
|
151
255
|
|
|
152
|
-
|
|
256
|
+
## Addressable 2.0.1 <a name="v2.0.1">
|
|
153
257
|
- fixed issue with query string assignment
|
|
154
258
|
- fixed issue with improperly encoded components
|
|
155
259
|
|
|
156
|
-
|
|
260
|
+
## Addressable 2.0.0 <a name="v2.0.0">
|
|
157
261
|
- the initialize method now takes an options hash as its only parameter
|
|
158
262
|
- added query_values method to URI class
|
|
159
263
|
- completely replaced IDNA implementation with pure Ruby
|
|
@@ -168,20 +272,20 @@
|
|
|
168
272
|
- updated URI Template code to match v 03 of the draft spec
|
|
169
273
|
- added a bunch of new specifications
|
|
170
274
|
|
|
171
|
-
|
|
275
|
+
## Addressable 1.0.4 <a name="v1.0.4">
|
|
172
276
|
- switched to using RSpec's pending system for specs that rely on IDN
|
|
173
277
|
- fixed issue with creating URIs with paths that are not prefixed with '/'
|
|
174
278
|
|
|
175
|
-
|
|
279
|
+
## Addressable 1.0.3 <a name="v1.0.3">
|
|
176
280
|
- implemented a hash method
|
|
177
281
|
|
|
178
|
-
|
|
282
|
+
## Addressable 1.0.2 <a name="v1.0.2">
|
|
179
283
|
- fixed minor bug with the extract_mapping method
|
|
180
284
|
|
|
181
|
-
|
|
285
|
+
## Addressable 1.0.1 <a name="v1.0.1">
|
|
182
286
|
- fixed minor bug with the extract_mapping method
|
|
183
287
|
|
|
184
|
-
|
|
288
|
+
## Addressable 1.0.0 <a name="v1.0.0">
|
|
185
289
|
- heuristic parse method added
|
|
186
290
|
- parsing is slightly more strict
|
|
187
291
|
- replaced to_h with to_hash
|
|
@@ -190,16 +294,16 @@
|
|
|
190
294
|
- improved heckle rake task
|
|
191
295
|
- no surviving heckle mutations
|
|
192
296
|
|
|
193
|
-
|
|
297
|
+
## Addressable 0.1.2 <a name="v0.1.2">
|
|
194
298
|
- improved normalization
|
|
195
299
|
- fixed bug in joining algorithm
|
|
196
300
|
- updated specifications
|
|
197
301
|
|
|
198
|
-
|
|
302
|
+
## Addressable 0.1.1 <a name="v0.1.1">
|
|
199
303
|
- updated documentation
|
|
200
304
|
- added URI Template variable extraction
|
|
201
305
|
|
|
202
|
-
|
|
306
|
+
## Addressable 0.1.0 <a name="v0.1.0">
|
|
203
307
|
- initial release
|
|
204
308
|
- implementation based on RFC 3986, 3987
|
|
205
309
|
- support for IRIs via libidn
|
data/Gemfile
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
source 'https://rubygems.org'
|
|
2
4
|
|
|
3
5
|
gemspec
|
|
4
6
|
|
|
5
7
|
group :test do
|
|
6
|
-
gem '
|
|
7
|
-
gem 'rspec
|
|
8
|
+
gem 'bigdecimal' if RUBY_VERSION > '2.4'
|
|
9
|
+
gem 'rspec', '~> 3.8'
|
|
10
|
+
gem 'rspec-its', '~> 1.3'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
group :coverage do
|
|
14
|
+
gem "coveralls", "> 0.7", require: false, platforms: :mri
|
|
15
|
+
gem "simplecov", require: false
|
|
8
16
|
end
|
|
9
17
|
|
|
10
18
|
group :development do
|
|
@@ -14,19 +22,10 @@ group :development do
|
|
|
14
22
|
end
|
|
15
23
|
|
|
16
24
|
group :test, :development do
|
|
17
|
-
gem '
|
|
18
|
-
gem
|
|
19
|
-
gem 'coveralls', :require => false, :platforms => [
|
|
20
|
-
:ruby_20, :ruby_21, :ruby_22, :ruby_23
|
|
21
|
-
]
|
|
22
|
-
# Used to test compatibility.
|
|
23
|
-
gem 'rack-mount', git: 'https://github.com/sporkmonger/rack-mount.git', require: 'rack/mount'
|
|
24
|
-
|
|
25
|
-
if RUBY_VERSION.start_with?('2.0', '2.1')
|
|
26
|
-
gem 'rack', '< 2', :require => false
|
|
27
|
-
else
|
|
28
|
-
gem 'rack', :require => false
|
|
29
|
-
end
|
|
25
|
+
gem 'memory_profiler'
|
|
26
|
+
gem "rake", ">= 12.3.3"
|
|
30
27
|
end
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
unless ENV["IDNA_MODE"] == "pure"
|
|
30
|
+
gem "idn-ruby", platform: :mri
|
|
31
|
+
end
|
data/README.md
CHANGED
|
@@ -7,31 +7,30 @@
|
|
|
7
7
|
<dt>License</dt><dd>Apache 2.0</dd>
|
|
8
8
|
</dl>
|
|
9
9
|
|
|
10
|
-
[][gemnasium]
|
|
10
|
+
[][gem]
|
|
11
|
+
[][actions]
|
|
13
12
|
[][coveralls]
|
|
14
|
-
[](https://www.gittip.com/sporkmonger/ "Support Open Source Development w/ Gittip")
|
|
13
|
+
[][inch]
|
|
16
14
|
|
|
17
15
|
[gem]: https://rubygems.org/gems/addressable
|
|
18
|
-
[
|
|
19
|
-
[gemnasium]: https://gemnasium.com/sporkmonger/addressable
|
|
16
|
+
[actions]: https://github.com/sporkmonger/addressable/actions
|
|
20
17
|
[coveralls]: https://coveralls.io/r/sporkmonger/addressable
|
|
21
|
-
[inch]:
|
|
18
|
+
[inch]: https://inch-ci.org/github/sporkmonger/addressable
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
## Description
|
|
24
21
|
|
|
25
|
-
Addressable is
|
|
26
|
-
Ruby's standard library. It
|
|
27
|
-
|
|
22
|
+
Addressable is an alternative implementation to the URI implementation
|
|
23
|
+
that is part of Ruby's standard library. It is flexible, offers heuristic
|
|
24
|
+
parsing, and additionally provides extensive support for IRIs and URI templates.
|
|
28
25
|
|
|
29
|
-
|
|
26
|
+
Addressable closely conforms to RFC 3986, RFC 3987, and RFC 6570 (level 4).
|
|
27
|
+
|
|
28
|
+
## Reference
|
|
30
29
|
|
|
31
30
|
- {Addressable::URI}
|
|
32
31
|
- {Addressable::Template}
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
## Example usage
|
|
35
34
|
|
|
36
35
|
```ruby
|
|
37
36
|
require "addressable/uri"
|
|
@@ -50,7 +49,7 @@ uri.normalize
|
|
|
50
49
|
```
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
## URI Templates
|
|
54
53
|
|
|
55
54
|
For more details, see [RFC 6570](https://www.rfc-editor.org/rfc/rfc6570.txt).
|
|
56
55
|
|
|
@@ -59,7 +58,7 @@ For more details, see [RFC 6570](https://www.rfc-editor.org/rfc/rfc6570.txt).
|
|
|
59
58
|
|
|
60
59
|
require "addressable/template"
|
|
61
60
|
|
|
62
|
-
template = Addressable::Template.new("http://example.com/{?query*}
|
|
61
|
+
template = Addressable::Template.new("http://example.com/{?query*}")
|
|
63
62
|
template.expand({
|
|
64
63
|
"query" => {
|
|
65
64
|
'foo' => 'bar',
|
|
@@ -89,7 +88,7 @@ template.extract(uri)
|
|
|
89
88
|
# }
|
|
90
89
|
```
|
|
91
90
|
|
|
92
|
-
|
|
91
|
+
## Install
|
|
93
92
|
|
|
94
93
|
```console
|
|
95
94
|
$ gem install addressable
|
|
@@ -99,19 +98,19 @@ You may optionally turn on native IDN support by installing libidn and the
|
|
|
99
98
|
idn gem:
|
|
100
99
|
|
|
101
100
|
```console
|
|
102
|
-
$ sudo apt-get install
|
|
101
|
+
$ sudo apt-get install libidn11-dev # Debian/Ubuntu
|
|
103
102
|
$ brew install libidn # OS X
|
|
104
103
|
$ gem install idn-ruby
|
|
105
104
|
```
|
|
106
105
|
|
|
107
|
-
|
|
106
|
+
## Semantic Versioning
|
|
108
107
|
|
|
109
|
-
This project uses
|
|
108
|
+
This project uses [Semantic Versioning](https://semver.org/). You can (and should) specify your
|
|
110
109
|
dependency using a pessimistic version constraint covering the major and minor
|
|
111
110
|
values:
|
|
112
111
|
|
|
113
112
|
```ruby
|
|
114
|
-
spec.add_dependency 'addressable', '~> 2.
|
|
113
|
+
spec.add_dependency 'addressable', '~> 2.7'
|
|
115
114
|
```
|
|
116
115
|
|
|
117
116
|
If you need a specific bug fix, you can also specify minimum tiny versions
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'rubygems'
|
|
2
4
|
require 'rake'
|
|
3
5
|
|
|
@@ -12,21 +14,24 @@ RELEASE_NAME = "REL #{PKG_VERSION}"
|
|
|
12
14
|
|
|
13
15
|
PKG_SUMMARY = "URI Implementation"
|
|
14
16
|
PKG_DESCRIPTION = <<-TEXT
|
|
15
|
-
Addressable is
|
|
16
|
-
Ruby's standard library. It
|
|
17
|
-
|
|
17
|
+
Addressable is an alternative implementation to the URI implementation that is
|
|
18
|
+
part of Ruby's standard library. It is flexible, offers heuristic parsing, and
|
|
19
|
+
additionally provides extensive support for IRIs and URI templates.
|
|
18
20
|
TEXT
|
|
19
21
|
|
|
20
22
|
PKG_FILES = FileList[
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
"data/**/*",
|
|
24
|
+
"lib/**/*.rb",
|
|
25
|
+
"spec/**/*.rb",
|
|
26
|
+
"tasks/**/*.rake",
|
|
27
|
+
"addressable.gemspec",
|
|
28
|
+
"CHANGELOG.md",
|
|
29
|
+
"Gemfile",
|
|
30
|
+
"LICENSE.txt",
|
|
31
|
+
"README.md",
|
|
32
|
+
"Rakefile",
|
|
33
|
+
]
|
|
26
34
|
|
|
27
35
|
task :default => "spec"
|
|
28
36
|
|
|
29
|
-
WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false
|
|
30
|
-
SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
|
|
31
|
-
|
|
32
37
|
Dir['tasks/**/*.rake'].each { |rake| load rake }
|
data/addressable.gemspec
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
# stub: addressable 2.8.8 ruby lib
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |s|
|
|
5
|
+
s.name = "addressable".freeze
|
|
6
|
+
s.version = "2.8.8".freeze
|
|
7
|
+
|
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
|
+
s.metadata = { "changelog_uri" => "https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md#v2.8.8" } if s.respond_to? :metadata=
|
|
10
|
+
s.require_paths = ["lib".freeze]
|
|
11
|
+
s.authors = ["Bob Aman".freeze]
|
|
12
|
+
s.date = "2025-11-24"
|
|
13
|
+
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
|
|
14
|
+
s.email = "bob@sporkmonger.com".freeze
|
|
15
|
+
s.extra_rdoc_files = ["README.md".freeze]
|
|
16
|
+
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]
|
|
17
|
+
s.homepage = "https://github.com/sporkmonger/addressable".freeze
|
|
18
|
+
s.licenses = ["Apache-2.0".freeze]
|
|
19
|
+
s.rdoc_options = ["--main".freeze, "README.md".freeze]
|
|
20
|
+
s.required_ruby_version = Gem::Requirement.new(">= 2.2".freeze)
|
|
21
|
+
s.rubygems_version = "3.7.2".freeze
|
|
22
|
+
s.summary = "URI Implementation".freeze
|
|
23
|
+
|
|
24
|
+
s.specification_version = 4
|
|
25
|
+
|
|
26
|
+
s.add_runtime_dependency(%q<public_suffix>.freeze, [">= 2.0.2".freeze, "< 8.0".freeze])
|
|
27
|
+
s.add_development_dependency(%q<bundler>.freeze, [">= 1.0".freeze, "< 3.0".freeze])
|
|
28
|
+
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
#--
|
|
3
4
|
# Copyright (C) Bob Aman
|
|
4
5
|
#
|
|
@@ -28,14 +29,20 @@ module Addressable
|
|
|
28
29
|
IDN::Punycode.decode(value.to_s)
|
|
29
30
|
end
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
class << self
|
|
33
|
+
# @deprecated Use {String#unicode_normalize(:nfkc)} instead
|
|
34
|
+
def unicode_normalize_kc(value)
|
|
35
|
+
value.to_s.unicode_normalize(:nfkc)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
extend Gem::Deprecate
|
|
39
|
+
deprecate :unicode_normalize_kc, "String#unicode_normalize(:nfkc)", 2023, 4
|
|
33
40
|
end
|
|
34
41
|
|
|
35
42
|
def self.to_ascii(value)
|
|
36
43
|
value.to_s.split('.', -1).map do |segment|
|
|
37
44
|
if segment.size > 0 && segment.size < 64
|
|
38
|
-
IDN::Idna.toASCII(segment)
|
|
45
|
+
IDN::Idna.toASCII(segment, IDN::Idna::ALLOW_UNASSIGNED)
|
|
39
46
|
elsif segment.size >= 64
|
|
40
47
|
segment
|
|
41
48
|
else
|
|
@@ -47,7 +54,7 @@ module Addressable
|
|
|
47
54
|
def self.to_unicode(value)
|
|
48
55
|
value.to_s.split('.', -1).map do |segment|
|
|
49
56
|
if segment.size > 0 && segment.size < 64
|
|
50
|
-
IDN::Idna.toUnicode(segment)
|
|
57
|
+
IDN::Idna.toUnicode(segment, IDN::Idna::ALLOW_UNASSIGNED)
|
|
51
58
|
elsif segment.size >= 64
|
|
52
59
|
segment
|
|
53
60
|
else
|