public_suffix 2.0.5 → 4.0.7
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/.github/FUNDING.yml +12 -0
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/release.yml +16 -0
- data/.github/workflows/tests.yml +28 -0
- data/.gitignore +5 -8
- data/.rubocop.yml +19 -1
- data/{.rubocop_defaults.yml → .rubocop_opinionated.yml} +62 -34
- data/CHANGELOG.md +156 -54
- data/Gemfile +9 -5
- data/LICENSE.txt +1 -1
- data/README.md +44 -15
- data/Rakefile +9 -4
- data/SECURITY.md +104 -0
- data/bin/console +15 -0
- data/data/list.txt +3163 -973
- data/lib/public_suffix/domain.rb +4 -4
- data/lib/public_suffix/errors.rb +3 -1
- data/lib/public_suffix/list.rb +78 -117
- data/lib/public_suffix/rule.rb +54 -62
- data/lib/public_suffix/version.rb +8 -3
- data/lib/public_suffix.rb +38 -32
- data/public_suffix.gemspec +9 -5
- data/test/.empty +2 -0
- data/test/acceptance_test.rb +43 -31
- data/test/benchmarks/bm_find.rb +66 -0
- data/test/benchmarks/bm_find_all.rb +102 -0
- data/test/benchmarks/bm_names.rb +91 -0
- data/test/benchmarks/bm_select.rb +26 -0
- data/test/benchmarks/bm_select_incremental.rb +25 -0
- data/test/benchmarks/bm_valid.rb +101 -0
- data/test/profilers/domain_profiler.rb +12 -0
- data/test/profilers/find_profiler.rb +12 -0
- data/test/profilers/find_profiler_jp.rb +12 -0
- data/test/{initialization_profiler.rb → profilers/initialization_profiler.rb} +1 -1
- data/test/profilers/list_profsize.rb +11 -0
- data/test/profilers/object_binsize.rb +57 -0
- data/test/psl_test.rb +7 -4
- data/test/test_helper.rb +3 -14
- data/test/unit/domain_test.rb +17 -15
- data/test/unit/errors_test.rb +2 -0
- data/test/unit/list_test.rb +54 -72
- data/test/unit/public_suffix_test.rb +24 -22
- data/test/unit/rule_test.rb +77 -79
- metadata +32 -70
- data/.ruby-gemset +0 -1
- data/.travis.yml +0 -23
- data/test/benchmark_helper.rb +0 -4
- data/test/execution_profiler.rb +0 -14
- data/test/performance_benchmark.rb +0 -38
data/CHANGELOG.md
CHANGED
|
@@ -1,150 +1,252 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This project uses [Semantic Versioning 2.0.0](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## 4.0.7
|
|
7
|
+
|
|
8
|
+
### Fixes
|
|
9
|
+
|
|
10
|
+
- Fixed YARD rake task (GH-179)
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Updated definitions.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 4.0.6
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Updated definitions.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## 4.0.5
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- Updated definitions.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## 4.0.4
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- Updated definitions.
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 4.0.3
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Fixed 2.7 deprecations and warnings (GH-167). [Thanks @BrianHawley]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## 4.0.2
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- Updated definitions.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## 4.0.1
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- Updated definitions.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## 4.0.0
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- Minimum Ruby version is 2.3
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## Release 3.1.1
|
|
67
|
+
|
|
68
|
+
- CHANGED: Updated definitions.
|
|
69
|
+
- CHANGED: Rolled back support for Ruby 2.3 (GH-161, GH-162)
|
|
70
|
+
|
|
71
|
+
IMPORTANT: 3.x is the latest version compatible with Ruby 2.1 and Ruby 2.2.
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Release 3.1.0
|
|
75
|
+
|
|
76
|
+
- CHANGED: Updated definitions.
|
|
77
|
+
- CHANGED: Minimum Ruby version is 2.3
|
|
78
|
+
- CHANGED: Upgraded to Bundler 2.x
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Release 3.0.3
|
|
82
|
+
|
|
83
|
+
- CHANGED: Updated definitions.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## Release 3.0.2
|
|
87
|
+
|
|
88
|
+
- CHANGED: Updated definitions.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Release 3.0.1
|
|
4
92
|
|
|
5
93
|
- CHANGED: Updated definitions.
|
|
94
|
+
- CHANGED: Improve performance and avoid allocation (GH-146). [Thanks @robholland]
|
|
6
95
|
|
|
96
|
+
|
|
97
|
+
## Release 3.0.0
|
|
98
|
+
|
|
99
|
+
This new version includes a major redesign of the library internals, with the goal to drastically
|
|
100
|
+
improve the lookup time while reducing storage space.
|
|
101
|
+
|
|
102
|
+
For this reason, several public methods that are no longer applicable have been deprecated
|
|
103
|
+
and/or removed. You can find more information at GH-133.
|
|
104
|
+
|
|
105
|
+
- CHANGED: Updated definitions.
|
|
106
|
+
- CHANGED: Dropped support for Ruby < 2.1
|
|
107
|
+
- CHANGED: `PublicSuffix::List#rules` is now protected. You should not rely on it as the internal rule representation is subject to change to optimize performances.
|
|
108
|
+
- CHANGED: Removed `PublicSuffix::List.clear`, it was an unnecessary accessor method. Use `PublicSuffix::List.default = nil` if you **really** need to reset the default list. You shouldn't.
|
|
109
|
+
- CHANGED: `PublicSuffix::List#select` is now private. You should not use it, instead use `PublicSuffix::List#find`.
|
|
110
|
+
- CHANGED: `PublicSuffix::List` no longer implements Enumerable. Instead, use `#each` to loop over, or get an Enumerator.
|
|
111
|
+
- CHANGED: Redesigned internal list storage and lookup algorithm to achieve O(1) lookup time (see GH-133).
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## Release 2.0.5
|
|
115
|
+
|
|
116
|
+
- CHANGED: Updated definitions.
|
|
7
117
|
- CHANGED: Initialization performance improvements (GH-128). [Thanks @casperisfine]
|
|
8
118
|
|
|
9
119
|
|
|
10
|
-
|
|
120
|
+
## Release 2.0.4
|
|
11
121
|
|
|
12
122
|
- FIXED: Fix a bug that caused the GEM to be published with the wrong version number in the gemspec (GH-121).
|
|
13
123
|
|
|
14
124
|
- CHANGED: Updated definitions.
|
|
15
125
|
|
|
16
126
|
|
|
17
|
-
|
|
127
|
+
## Release 2.0.3
|
|
18
128
|
|
|
19
129
|
- CHANGED: Updated definitions.
|
|
20
130
|
|
|
21
131
|
|
|
22
|
-
|
|
132
|
+
## Release 2.0.2
|
|
23
133
|
|
|
24
134
|
- CHANGED: Updated definitions.
|
|
25
135
|
|
|
26
136
|
|
|
27
|
-
|
|
137
|
+
## Release 2.0.1
|
|
28
138
|
|
|
29
139
|
- FIXED: Fix bug that prevented .valid? to reset the default rule
|
|
30
140
|
|
|
31
141
|
|
|
32
|
-
|
|
142
|
+
## Release 2.0.0
|
|
33
143
|
|
|
34
144
|
- NEW: Added PublicSuffix.domain # => sld.tld
|
|
35
|
-
|
|
36
145
|
- NEW: Added the ability to disable the use of private domains either at runtime, in addition to the ability to not load the private domains section when reading the list (`private_domains: false`). This feature also superseded the `private_domains` class-level attribute, that is no longer available.
|
|
37
146
|
|
|
38
147
|
- CHANGED: Considerable performance improvements (GH-92)
|
|
39
|
-
|
|
40
148
|
- CHANGED: Updated definitions.
|
|
41
|
-
|
|
42
149
|
- CHANGED: Removed deprecated PublicSuffix::InvalidDomain exception
|
|
43
|
-
|
|
44
150
|
- CHANGED: If the suffix is now listed, then the prevaling rule is "*" as defined by the PSL algorithm (GH-91)
|
|
45
|
-
|
|
46
151
|
- CHANGED: Input validation is performed only if you call `PublicSuffix.parse` or `PublicSuffix.list`
|
|
47
|
-
|
|
48
152
|
- CHANGED: Input with leading dot is invalid per PSL acceptance tests
|
|
49
|
-
|
|
50
153
|
- CHANGED: Removed `private_domains` class-level attribute. It is replaced by the `private_domains: false` option in the list parse method.
|
|
51
|
-
|
|
52
154
|
- CHANGED: The default list now assumes you use UTF-8 for reading the input (GH-94),
|
|
53
155
|
|
|
54
156
|
- REMOVED: Removed futile utility helpers such as `Domain#rule`, `Domain#is_a_domain?`, `Domain#is_a_subdomain?`, `Domain#valid?`. You can easily obtain the same result by having a custom method that reconstructs the logic, and/or calling `PublicSuffix.{domain|parse}(domain.to_s)`.
|
|
55
157
|
|
|
56
158
|
|
|
57
|
-
|
|
159
|
+
## Release 1.5.3
|
|
58
160
|
|
|
59
161
|
- FIXED: Don't duplicate rule indices when creating index (GH-77). [Thanks @ags]
|
|
60
162
|
|
|
61
163
|
- CHANGED: Updated definitions.
|
|
62
164
|
|
|
63
165
|
|
|
64
|
-
|
|
166
|
+
## Release 1.5.2
|
|
65
167
|
|
|
66
168
|
- CHANGED: Updated definitions.
|
|
67
169
|
|
|
68
170
|
|
|
69
|
-
|
|
171
|
+
## Release 1.5.1
|
|
70
172
|
|
|
71
173
|
- FIXED: Ignore case for parsing and validating (GH-62)
|
|
72
174
|
|
|
73
175
|
- CHANGED: Updated definitions.
|
|
74
176
|
|
|
75
177
|
|
|
76
|
-
|
|
178
|
+
## Release 1.5.0
|
|
77
179
|
|
|
78
180
|
- CHANGED: Dropped support for Ruby < 2.0
|
|
79
181
|
|
|
80
182
|
- CHANGED: Updated definitions.
|
|
81
183
|
|
|
82
184
|
|
|
83
|
-
|
|
185
|
+
## Release 1.4.6
|
|
84
186
|
|
|
85
187
|
- CHANGED: Updated definitions.
|
|
86
188
|
|
|
87
189
|
|
|
88
|
-
|
|
190
|
+
## Release 1.4.5
|
|
89
191
|
|
|
90
192
|
- CHANGED: Updated definitions.
|
|
91
193
|
|
|
92
194
|
|
|
93
|
-
|
|
195
|
+
## Release 1.4.4
|
|
94
196
|
|
|
95
197
|
- CHANGED: Updated definitions.
|
|
96
198
|
|
|
97
199
|
|
|
98
|
-
|
|
200
|
+
## Release 1.4.3
|
|
99
201
|
|
|
100
202
|
- CHANGED: Updated definitions.
|
|
101
203
|
|
|
102
204
|
|
|
103
|
-
|
|
205
|
+
## Release 1.4.2
|
|
104
206
|
|
|
105
207
|
- CHANGED: Updated definitions.
|
|
106
208
|
|
|
107
209
|
|
|
108
|
-
|
|
210
|
+
## Release 1.4.1
|
|
109
211
|
|
|
110
212
|
- CHANGED: Updated definitions.
|
|
111
213
|
|
|
112
214
|
|
|
113
|
-
|
|
215
|
+
## Release 1.4.0
|
|
114
216
|
|
|
115
217
|
- CHANGED: Moved the definitions in the lib folder.
|
|
116
218
|
|
|
117
219
|
- CHANGED: Updated definitions.
|
|
118
220
|
|
|
119
221
|
|
|
120
|
-
|
|
222
|
+
## Release 1.3.3
|
|
121
223
|
|
|
122
224
|
- CHANGED: Updated definitions.
|
|
123
225
|
|
|
124
226
|
|
|
125
|
-
|
|
227
|
+
## Release 1.3.2
|
|
126
228
|
|
|
127
229
|
- CHANGED: Updated definitions.
|
|
128
230
|
|
|
129
231
|
|
|
130
|
-
|
|
232
|
+
## Release 1.3.1
|
|
131
233
|
|
|
132
234
|
- CHANGED: Updated definitions.
|
|
133
235
|
|
|
134
236
|
|
|
135
|
-
|
|
237
|
+
## Release 1.3.0
|
|
136
238
|
|
|
137
239
|
- NEW: Ability to skip Private Domains (GH-28). [Thanks @rb2k]
|
|
138
240
|
|
|
139
241
|
- CHANGED: Updated definitions.
|
|
140
242
|
|
|
141
243
|
|
|
142
|
-
|
|
244
|
+
## Release 1.2.1
|
|
143
245
|
|
|
144
246
|
- CHANGED: Updated definitions.
|
|
145
247
|
|
|
146
248
|
|
|
147
|
-
|
|
249
|
+
## Release 1.2.0
|
|
148
250
|
|
|
149
251
|
- NEW: Allow a custom List on `PublicSuffix.parse` (GH-26). [Thanks @itspriddle]
|
|
150
252
|
|
|
@@ -153,22 +255,22 @@
|
|
|
153
255
|
- CHANGED: Updated definitions.
|
|
154
256
|
|
|
155
257
|
|
|
156
|
-
|
|
258
|
+
## Release 1.1.3
|
|
157
259
|
|
|
158
260
|
- CHANGED: Updated definitions.
|
|
159
261
|
|
|
160
262
|
|
|
161
|
-
|
|
263
|
+
## Release 1.1.2
|
|
162
264
|
|
|
163
265
|
- CHANGED: Updated definitions.
|
|
164
266
|
|
|
165
267
|
|
|
166
|
-
|
|
268
|
+
## Release 1.1.1
|
|
167
269
|
|
|
168
270
|
- CHANGED: Updated definitions.
|
|
169
271
|
|
|
170
272
|
|
|
171
|
-
|
|
273
|
+
## Release 1.1.0
|
|
172
274
|
|
|
173
275
|
- FIXED: #valid? and #parse consider URIs as valid domains (GH-15)
|
|
174
276
|
|
|
@@ -177,17 +279,17 @@
|
|
|
177
279
|
- CHANGED: Removed deprecatd PublicSuffixService::RuleList.
|
|
178
280
|
|
|
179
281
|
|
|
180
|
-
|
|
282
|
+
## Release 1.0.0
|
|
181
283
|
|
|
182
284
|
- CHANGED: Updated definitions.
|
|
183
285
|
|
|
184
286
|
|
|
185
|
-
|
|
287
|
+
## Release 1.0.0.rc1
|
|
186
288
|
|
|
187
289
|
The library is now known as PublicSuffix.
|
|
188
290
|
|
|
189
291
|
|
|
190
|
-
|
|
292
|
+
## Release 0.9.1
|
|
191
293
|
|
|
192
294
|
- CHANGED: Renamed PublicSuffixService::RuleList to PublicSuffixService::List.
|
|
193
295
|
|
|
@@ -198,20 +300,20 @@ The library is now known as PublicSuffix.
|
|
|
198
300
|
- CHANGED: Updated definitions.
|
|
199
301
|
|
|
200
302
|
|
|
201
|
-
|
|
303
|
+
## Release 0.9.0
|
|
202
304
|
|
|
203
305
|
- CHANGED: Minimum Ruby version increased to Ruby 1.8.7.
|
|
204
306
|
|
|
205
307
|
- CHANGED: rake/gempackagetask is deprecated. Use rubygems/package_task instead.
|
|
206
308
|
|
|
207
309
|
|
|
208
|
-
|
|
310
|
+
## Release 0.8.4
|
|
209
311
|
|
|
210
312
|
- FIXED: Reverted bugfix for issue #12 for Ruby 1.8.6.
|
|
211
313
|
This is the latest version compatible with Ruby 1.8.6.
|
|
212
314
|
|
|
213
315
|
|
|
214
|
-
|
|
316
|
+
## Release 0.8.3
|
|
215
317
|
|
|
216
318
|
- FIXED: Fixed ArgumentError: invalid byte sequence in US-ASCII with Ruby 1.9.2 (#12).
|
|
217
319
|
|
|
@@ -220,7 +322,7 @@ The library is now known as PublicSuffix.
|
|
|
220
322
|
- CHANGED: Renamed definitions.txt to definitions.dat.
|
|
221
323
|
|
|
222
324
|
|
|
223
|
-
|
|
325
|
+
## Release 0.8.2
|
|
224
326
|
|
|
225
327
|
- NEW: Added support for rubygems-test.
|
|
226
328
|
|
|
@@ -229,19 +331,19 @@ The library is now known as PublicSuffix.
|
|
|
229
331
|
- CHANGED: Updated definitions.
|
|
230
332
|
|
|
231
333
|
|
|
232
|
-
|
|
334
|
+
## Release 0.8.1
|
|
233
335
|
|
|
234
336
|
- FIXED: The files in the release 0.8.0 have wrong permission 600 and can't be loaded (#10).
|
|
235
337
|
|
|
236
338
|
|
|
237
|
-
|
|
339
|
+
## Release 0.8.0
|
|
238
340
|
|
|
239
341
|
- CHANGED: Update public suffix list to d1a5599b49fa 2010-10-25 15:10 +0100 (#9)
|
|
240
342
|
|
|
241
343
|
- NEW: Add support for Fully Qualified Domain Names (#7)
|
|
242
344
|
|
|
243
345
|
|
|
244
|
-
|
|
346
|
+
## Release 0.7.0
|
|
245
347
|
|
|
246
348
|
- CHANGED: Using YARD to document the code instead of RDoc.
|
|
247
349
|
|
|
@@ -250,7 +352,7 @@ The library is now known as PublicSuffix.
|
|
|
250
352
|
- FIXED: PublicSuffixService.valid? should return false if the domain is not defined or not allowed (#4, #5)
|
|
251
353
|
|
|
252
354
|
|
|
253
|
-
|
|
355
|
+
## Release 0.6.0
|
|
254
356
|
|
|
255
357
|
- NEW: PublicSuffixService.parse raises DomainNotAllowed when trying to parse a domain name
|
|
256
358
|
which exists, but is not allowed by the current definition list (#3)
|
|
@@ -261,34 +363,34 @@ The library is now known as PublicSuffix.
|
|
|
261
363
|
- CHANGED: Renamed PublicSuffixService::InvalidDomain to PublicSuffixService::DomainInvalid
|
|
262
364
|
|
|
263
365
|
|
|
264
|
-
|
|
366
|
+
## Release 0.5.2
|
|
265
367
|
|
|
266
368
|
- CHANGED: Update public suffix list to 248ea690d671 2010-09-16 18:02 +0100
|
|
267
369
|
|
|
268
370
|
|
|
269
|
-
|
|
371
|
+
## Release 0.5.1
|
|
270
372
|
|
|
271
373
|
- CHANGED: Update public suffix list to 14dc66dd53c1 2010-09-15 17:09 +0100
|
|
272
374
|
|
|
273
375
|
|
|
274
|
-
|
|
376
|
+
## Release 0.5.0
|
|
275
377
|
|
|
276
378
|
- CHANGED: Improve documentation for Domain#domain and Domain#subdomain (#1).
|
|
277
379
|
|
|
278
380
|
- CHANGED: Performance improvements (#2).
|
|
279
381
|
|
|
280
382
|
|
|
281
|
-
|
|
383
|
+
## Release 0.4.0
|
|
282
384
|
|
|
283
385
|
- CHANGED: Rename library from DomainName to PublicSuffixService to reduce the probability of name conflicts.
|
|
284
386
|
|
|
285
387
|
|
|
286
|
-
|
|
388
|
+
## Release 0.3.1
|
|
287
389
|
|
|
288
390
|
- Deprecated DomainName library.
|
|
289
391
|
|
|
290
392
|
|
|
291
|
-
|
|
393
|
+
## Release 0.3.0
|
|
292
394
|
|
|
293
395
|
- CHANGED: DomainName#domain and DomainName#subdomain are no longer alias of Domain#sld and Domain#tld.
|
|
294
396
|
|
|
@@ -299,7 +401,7 @@ The library is now known as PublicSuffix.
|
|
|
299
401
|
- CHANGED: Refactoring the entire DomainName API. Removed the internal on-the-fly parsing. Added a bunch of new methods to check and validate the DomainName.
|
|
300
402
|
|
|
301
403
|
|
|
302
|
-
|
|
404
|
+
## Release 0.2.0
|
|
303
405
|
|
|
304
406
|
- NEW: DomainName#valid?
|
|
305
407
|
|
|
@@ -310,6 +412,6 @@ The library is now known as PublicSuffix.
|
|
|
310
412
|
- CHANGED: Make sure RuleList lookup is only performed once.
|
|
311
413
|
|
|
312
414
|
|
|
313
|
-
|
|
415
|
+
## Release 0.1.0
|
|
314
416
|
|
|
315
417
|
- Initial version
|
data/Gemfile
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
2
4
|
|
|
3
5
|
gemspec
|
|
4
6
|
|
|
5
|
-
gem "
|
|
7
|
+
gem "rake"
|
|
8
|
+
|
|
9
|
+
gem "memory_profiler", require: false
|
|
6
10
|
gem "minitest"
|
|
7
11
|
gem "minitest-reporters"
|
|
8
|
-
gem "
|
|
9
|
-
|
|
10
|
-
gem "
|
|
12
|
+
gem "mocha"
|
|
13
|
+
gem "rubocop", "~>0.90", require: false
|
|
14
|
+
gem "yard"
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
<tt>PublicSuffix</tt> is a Ruby domain name parser based on the [Public Suffix List](https://publicsuffix.org/).
|
|
4
4
|
|
|
5
|
-
[](https://github.com/weppos/publicsuffix-ruby/actions/workflows/tests.yml)
|
|
6
|
+
[](https://tidelift.com/subscription/pkg/rubygems-public-suffix?utm_source=rubygems-public-suffix&utm_medium=referral&utm_campaign=enterprise)
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
##
|
|
9
|
+
## Links
|
|
10
|
+
|
|
11
|
+
- [Homepage](https://simonecarletti.com/code/publicsuffix-ruby)
|
|
12
|
+
- [Repository](https://github.com/weppos/publicsuffix-ruby)
|
|
13
|
+
- [API Documentation](https://rubydoc.info/gems/public_suffix)
|
|
14
|
+
- [Introducing the Public Suffix List library for Ruby](https://simonecarletti.com/blog/2010/06/public-suffix-list-library-for-ruby/)
|
|
15
|
+
|
|
9
16
|
|
|
10
|
-
|
|
17
|
+
## Requirements
|
|
11
18
|
|
|
12
|
-
For an older versions of Ruby use a previous release.
|
|
19
|
+
<tt>PublicSuffix</tt> requires **Ruby >= 2.3**. For an older versions of Ruby use a previous release.
|
|
13
20
|
|
|
14
21
|
|
|
15
22
|
## Installation
|
|
@@ -17,7 +24,7 @@ For an older versions of Ruby use a previous release.
|
|
|
17
24
|
You can install the gem manually:
|
|
18
25
|
|
|
19
26
|
```shell
|
|
20
|
-
|
|
27
|
+
gem install public_suffix
|
|
21
28
|
```
|
|
22
29
|
|
|
23
30
|
Or use Bundler and define it as a dependency in your `Gemfile`:
|
|
@@ -87,8 +94,20 @@ PublicSuffix.valid?("www.google.com")
|
|
|
87
94
|
# Explicitly forbidden, it is listed as a private domain
|
|
88
95
|
PublicSuffix.valid?("blogspot.com")
|
|
89
96
|
# => false
|
|
97
|
+
|
|
98
|
+
# Unknown/not-listed TLD domains are valid by default
|
|
99
|
+
PublicSuffix.valid?("example.tldnotlisted")
|
|
100
|
+
# => true
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Strict validation (without applying the default * rule):
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
PublicSuffix.valid?("example.tldnotlisted", default_rule: nil)
|
|
107
|
+
# => false
|
|
90
108
|
```
|
|
91
109
|
|
|
110
|
+
|
|
92
111
|
## Fully Qualified Domain Names
|
|
93
112
|
|
|
94
113
|
This library automatically recognizes Fully Qualified Domain Names. A FQDN is a domain name that end with a trailing dot.
|
|
@@ -161,21 +180,19 @@ Not convinced yet? Check out [this real world example](https://stackoverflow.com
|
|
|
161
180
|
No. <tt>PublicSuffix</tt> comes with a bundled list. It does not make any HTTP requests to parse or validate a domain.
|
|
162
181
|
|
|
163
182
|
|
|
164
|
-
##
|
|
183
|
+
## Support
|
|
165
184
|
|
|
166
|
-
|
|
185
|
+
Library documentation is auto-generated from the [README](https://github.com/weppos/publicsuffix-ruby/blob/master/README.md) and the source code, and it's available at https://rubydoc.info/gems/public_suffix.
|
|
167
186
|
|
|
168
|
-
|
|
187
|
+
- The PublicSuffix bug tracker is here: https://github.com/weppos/publicsuffix-ruby/issues
|
|
188
|
+
- The PublicSuffix code repository is here: https://github.com/weppos/publicsuffix-ruby. Contributions are welcome! Please include tests and/or feature coverage for every patch, and create a topic branch for every separate change you make.
|
|
169
189
|
|
|
170
|
-
|
|
190
|
+
[Consider subscribing to Tidelift which provides Enterprise support for this project](https://tidelift.com/subscription/pkg/rubygems-public-suffix?utm_source=rubygems-public-suffix&utm_medium=referral&utm_campaign=readme) as part of the Tidelift Subscription. Tidelift subscriptions also help the maintainers by funding the project, which in turn allows us to ship releases, bugfixes, and security updates more often.
|
|
171
191
|
|
|
172
192
|
|
|
173
|
-
##
|
|
193
|
+
## Security and Vulnerability Reporting
|
|
174
194
|
|
|
175
|
-
|
|
176
|
-
- [Repository](https://github.com/weppos/publicsuffix-ruby)
|
|
177
|
-
- [API Documentation](http://rubydoc.info/gems/public_suffix)
|
|
178
|
-
- [Introducing the Public Suffix List library for Ruby](https://simonecarletti.com/blog/2010/06/public-suffix-list-library-for-ruby/)
|
|
195
|
+
Full information and description of our security policy please visit [`SECURITY.md`](SECURITY.md)
|
|
179
196
|
|
|
180
197
|
|
|
181
198
|
## Changelog
|
|
@@ -185,4 +202,16 @@ See the [CHANGELOG.md](CHANGELOG.md) file for details.
|
|
|
185
202
|
|
|
186
203
|
## License
|
|
187
204
|
|
|
188
|
-
Copyright (c) 2009-
|
|
205
|
+
Copyright (c) 2009-2022 Simone Carletti. This is Free Software distributed under the MIT license.
|
|
206
|
+
|
|
207
|
+
The [Public Suffix List source](https://publicsuffix.org/list/) is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
208
|
+
|
|
209
|
+
## Definitions
|
|
210
|
+
|
|
211
|
+
tld = Top level domain, this is in reference to the last segment of a domain, sometimes the part that is directly after the "dot" symbol. For example, `mozilla.org`, the `.org` portion is the tld.
|
|
212
|
+
|
|
213
|
+
sld = Second level domain, a domain that is directly below a top-level domain. For example, in `https://www.mozilla.org/en-US/`, `mozilla` is the second-level domain of the .org tld.
|
|
214
|
+
|
|
215
|
+
trd = Transit routing domain, or known as a subdomain. This is the part of the domain that is before the sld or root domain. For example, in `https://www.mozilla.org/en-US/`, `www` is the trd.
|
|
216
|
+
|
|
217
|
+
FQDN = Fully Qualified Domain Names, are domain names that are written with the hostname and the domain name, and include the top-level domain, the format looks like `[hostname].[domain].[tld].` for ex. `[www].[mozilla].[org]`.
|
data/Rakefile
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "bundler/gem_tasks"
|
|
2
4
|
|
|
3
5
|
# By default, run tests and linter.
|
|
@@ -18,6 +20,7 @@ require "rubocop/rake_task"
|
|
|
18
20
|
RuboCop::RakeTask.new
|
|
19
21
|
|
|
20
22
|
|
|
23
|
+
require "yard"
|
|
21
24
|
require "yard/rake/yardoc_task"
|
|
22
25
|
|
|
23
26
|
YARD::Rake::YardocTask.new(:yardoc) do |y|
|
|
@@ -27,17 +30,19 @@ end
|
|
|
27
30
|
CLOBBER.include "yardoc"
|
|
28
31
|
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
task :benchmarks do
|
|
34
|
+
Dir["benchmarks/bm_*.rb"].each do |file|
|
|
35
|
+
sh "ruby #{file}"
|
|
36
|
+
end
|
|
33
37
|
end
|
|
38
|
+
task default: [:benchmarks] if ENV["BENCHMARKS"] == "1"
|
|
34
39
|
|
|
35
40
|
|
|
36
41
|
desc "Downloads the Public Suffix List file from the repository and stores it locally."
|
|
37
42
|
task :"update-list" do
|
|
38
43
|
require "net/http"
|
|
39
44
|
|
|
40
|
-
DEFINITION_URL = "https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat"
|
|
45
|
+
DEFINITION_URL = "https://raw.githubusercontent.com/publicsuffix/list/master/public_suffix_list.dat"
|
|
41
46
|
|
|
42
47
|
File.open("data/list.txt", "w+") do |f|
|
|
43
48
|
response = Net::HTTP.get_response(URI.parse(DEFINITION_URL))
|