public_suffix 6.0.2 → 7.0.0
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +38 -29
- data/RELEASING.md +95 -0
- data/data/list.txt +520 -172
- data/lib/public_suffix/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '084a35b60185cb9effa86043e48492bbdef04d05f0f25b022cd4814b812b3de2'
|
|
4
|
+
data.tar.gz: 70c513a2c19d770c0d6d929a9bb8fe868a9df87b899af6eaf4ffe24a4acfc903
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 867e2369292df3275da727802270527999530fff53b9683228edf4f183e9f8fd7592cb3da2d2bf0923f2b7c727e778dbc45e329f234e7f1869d74f298994bf5a
|
|
7
|
+
data.tar.gz: 9fbbcf8839be0685d98d91e6fb44ec010f3dd2c3e80469b57b1138465701b3b0168da508aa3f7c8a3e46897c8135b337b2b64e1d17fb058e4de02a11efc4e984
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# PublicSuffix for Ruby
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`PublicSuffix` is a Ruby domain name parser based on the [Public Suffix List](https://publicsuffix.org/).
|
|
4
4
|
|
|
5
5
|
[](https://github.com/weppos/publicsuffix-ruby/actions/workflows/tests.yml)
|
|
6
6
|
[](https://tidelift.com/subscription/pkg/rubygems-public-suffix?utm_source=rubygems-public-suffix&utm_medium=referral&utm_campaign=enterprise)
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
## Requirements
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
`PublicSuffix` requires **Ruby >= 3.2**. For older versions of Ruby, use a previous release.
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
@@ -106,9 +106,9 @@ PublicSuffix.valid?("example.tldnotlisted", default_rule: nil)
|
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
## Fully
|
|
109
|
+
## Fully qualified domain names
|
|
110
110
|
|
|
111
|
-
This library automatically recognizes Fully Qualified Domain Names. A FQDN is a domain name that
|
|
111
|
+
This library automatically recognizes Fully Qualified Domain Names. A FQDN is a domain name that ends with a trailing dot.
|
|
112
112
|
|
|
113
113
|
```ruby
|
|
114
114
|
# Parse a standard domain name
|
|
@@ -122,7 +122,7 @@ PublicSuffix.domain("www.google.com.")
|
|
|
122
122
|
|
|
123
123
|
## Private domains
|
|
124
124
|
|
|
125
|
-
This library
|
|
125
|
+
This library supports toggling private (non-ICANN) domain handling.
|
|
126
126
|
|
|
127
127
|
```ruby
|
|
128
128
|
# Extract a domain including private domains (by default)
|
|
@@ -148,15 +148,15 @@ PublicSuffix.domain("something.blogspot.com")
|
|
|
148
148
|
# => "blogspot.com"
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
##
|
|
151
|
+
## Adding custom domains
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
To manually add a domain to the list:
|
|
154
154
|
|
|
155
155
|
```ruby
|
|
156
156
|
PublicSuffix::List.default << PublicSuffix::Rule.factory('onmicrosoft.com')
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
## What is the
|
|
159
|
+
## What is the public suffix list?
|
|
160
160
|
|
|
161
161
|
The [Public Suffix List](https://publicsuffix.org) is a cross-vendor initiative to provide an accurate list of domain name suffixes.
|
|
162
162
|
|
|
@@ -165,7 +165,7 @@ The Public Suffix List is an initiative of the Mozilla Project, but is maintaine
|
|
|
165
165
|
A "public suffix" is one under which Internet users can directly register names. Some examples of public suffixes are ".com", ".co.uk" and "pvt.k12.wy.us". The Public Suffix List is a list of all known public suffixes.
|
|
166
166
|
|
|
167
167
|
|
|
168
|
-
## Why the
|
|
168
|
+
## Why use the public suffix list instead of regular expressions?
|
|
169
169
|
|
|
170
170
|
Previously, browsers used an algorithm which basically only denied setting wide-ranging cookies for top-level domains with no dots (e.g. com or org). However, this did not work for top-level domains where only third-level registrations are allowed (e.g. co.uk). In these cases, websites could set a cookie for co.uk which will be passed onto every website registered under co.uk.
|
|
171
171
|
|
|
@@ -180,43 +180,52 @@ Source: https://wiki.mozilla.org/Public_Suffix_List
|
|
|
180
180
|
Not convinced yet? Check out [this real world example](https://stackoverflow.com/q/288810/123527).
|
|
181
181
|
|
|
182
182
|
|
|
183
|
-
## Does
|
|
183
|
+
## Does PublicSuffix make network requests?
|
|
184
184
|
|
|
185
|
-
No.
|
|
185
|
+
No. `PublicSuffix` comes with a bundled list. It does not make any HTTP requests to parse or validate a domain.
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
##
|
|
188
|
+
## Terminology
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
- **TLD** (Top-Level Domain): The last segment of a domain name. For example, in `mozilla.org`, the `.org` portion is the TLD.
|
|
191
191
|
|
|
192
|
-
-
|
|
193
|
-
- 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.
|
|
192
|
+
- **SLD** (Second-Level Domain): A domain 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.
|
|
194
193
|
|
|
195
|
-
|
|
194
|
+
- **TRD** (Third-Level Domain): Also known as a subdomain, this is the part of the domain before the SLD or root domain. For example, in `https://www.mozilla.org/en-US/`, `www` is the TRD.
|
|
196
195
|
|
|
196
|
+
- **FQDN** (Fully Qualified Domain Name): A complete domain name that includes the hostname, domain, and top-level domain, ending with a trailing dot. The format is `[hostname].[domain].[tld].` (e.g., `www.mozilla.org.`).
|
|
197
197
|
|
|
198
|
-
## Security and Vulnerability Reporting
|
|
199
198
|
|
|
200
|
-
|
|
199
|
+
## Documentation and support
|
|
201
200
|
|
|
201
|
+
### Documentation
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
Library documentation is auto-generated from the [README](https://github.com/weppos/publicsuffix-ruby/blob/master/README.md) and source code, and is available at https://rubydoc.info/gems/public_suffix.
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
### Bug reports and contributions
|
|
206
206
|
|
|
207
|
+
- **Bug Tracker**: https://github.com/weppos/publicsuffix-ruby/issues
|
|
208
|
+
- **Code Repository**: https://github.com/weppos/publicsuffix-ruby
|
|
207
209
|
|
|
208
|
-
|
|
210
|
+
Contributions are welcome! Please include tests and/or feature coverage for every patch, and create a topic branch for every separate change you make.
|
|
209
211
|
|
|
210
|
-
|
|
212
|
+
### Enterprise support
|
|
211
213
|
|
|
212
|
-
|
|
214
|
+
[Consider subscribing to Tidelift](https://tidelift.com/subscription/pkg/rubygems-public-suffix?utm_source=rubygems-public-suffix&utm_medium=referral&utm_campaign=readme), which provides enterprise support for this project as part of the Tidelift Subscription. Tidelift subscriptions help fund the project, allowing us to ship releases, bugfixes, and security updates more frequently.
|
|
213
215
|
|
|
214
|
-
## Definitions
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
## Security and vulnerability reporting
|
|
217
218
|
|
|
218
|
-
|
|
219
|
+
For full information and details about our security policy, please visit [`SECURITY.md`](SECURITY.md).
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## Changelog
|
|
219
223
|
|
|
220
|
-
|
|
224
|
+
See [CHANGELOG.md](CHANGELOG.md) for details.
|
|
221
225
|
|
|
222
|
-
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
Copyright (c) 2009-2025 Simone Carletti. This is Free Software distributed under the MIT license.
|
|
230
|
+
|
|
231
|
+
The [Public Suffix List source](https://publicsuffix.org/list/) is subject to the terms of the Mozilla Public License, v. 2.0.
|
data/RELEASING.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Releasing
|
|
2
|
+
|
|
3
|
+
This document describes the steps to release a new version of PublicSuffix.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- You have commit access to the repository
|
|
8
|
+
- You have push access to the repository
|
|
9
|
+
- You have a GPG key configured for signing tags
|
|
10
|
+
- You have permission to publish to RubyGems
|
|
11
|
+
|
|
12
|
+
## Release process
|
|
13
|
+
|
|
14
|
+
1. **Determine the new version** using [Semantic Versioning](https://semver.org/)
|
|
15
|
+
|
|
16
|
+
```shell
|
|
17
|
+
VERSION=X.Y.Z
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- **MAJOR** version for incompatible API changes
|
|
21
|
+
- **MINOR** version for backwards-compatible functionality additions
|
|
22
|
+
- **PATCH** version for backwards-compatible bug fixes
|
|
23
|
+
|
|
24
|
+
2. **Update the version file** with the new version
|
|
25
|
+
|
|
26
|
+
Edit `lib/public_suffix/version.rb` and update the `VERSION` constant:
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
VERSION = "X.Y.Z"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3. **Update the changelog** with the new version
|
|
33
|
+
|
|
34
|
+
Edit `CHANGELOG.md` and add a new section for the release:
|
|
35
|
+
|
|
36
|
+
```markdown
|
|
37
|
+
## vX.Y.Z
|
|
38
|
+
|
|
39
|
+
- Description of changes
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
4. **Install dependencies**
|
|
43
|
+
|
|
44
|
+
```shell
|
|
45
|
+
bundle install
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
or simply:
|
|
49
|
+
|
|
50
|
+
```shell
|
|
51
|
+
bundle
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
5. **Run tests** and confirm they pass
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
bundle exec rake test
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
6. **Commit the new version**
|
|
61
|
+
|
|
62
|
+
```shell
|
|
63
|
+
git add lib/public_suffix/version.rb CHANGELOG.md Gemfile.lock
|
|
64
|
+
git commit -m "Release $VERSION"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
7. **Create a signed tag**
|
|
68
|
+
|
|
69
|
+
```shell
|
|
70
|
+
git tag -a v$VERSION -s -m "Release $VERSION"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
8. **Push the changes and tag**
|
|
74
|
+
|
|
75
|
+
```shell
|
|
76
|
+
git push origin main
|
|
77
|
+
git push origin v$VERSION
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
9. **Build and publish the gem**
|
|
81
|
+
|
|
82
|
+
```shell
|
|
83
|
+
bundle exec rake release
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
This will:
|
|
87
|
+
- Build the gem
|
|
88
|
+
- Push it to RubyGems
|
|
89
|
+
- Create a GitHub release
|
|
90
|
+
|
|
91
|
+
## Post-release
|
|
92
|
+
|
|
93
|
+
- Verify the new version appears on [RubyGems](https://rubygems.org/gems/public_suffix)
|
|
94
|
+
- Verify the GitHub release was created
|
|
95
|
+
- Announce the release if necessary
|