whois 6.0.1 → 6.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9783dca8336df04d4554e54f30f71d58c5d5dbdb9a4857e513b37be4ca3aae09
4
- data.tar.gz: cfecb0ebe734dcdc78825d09dccf208bc4f47dcc212fa1a4df97b7bef9f74ea1
3
+ metadata.gz: 323b84ddf445360ef0ca8b34255c4c0e757e093686977527e48daa8a075bde0f
4
+ data.tar.gz: 8623b98ca2197553455cbe492985998e57da97c33365764ddca3db4d88654048
5
5
  SHA512:
6
- metadata.gz: 6da4a414226e3f3b838f5a5df21d0598ccd90e133eb46174bef22e52bd8a8eff945cff85dcbb41644ca6a9fc03e77c580885b5dfbb755a0e8e68ad4a4255741b
7
- data.tar.gz: 4aeadb9da22d6fb89b71e49fbe2986f33f45ee7917f7389f443af15ff44233cfc34db9d6bbc6359a55618ab9303d2b921a750d3b8edefe773bc89a137cedd653
6
+ metadata.gz: '02905cd1c4afad69252755c353d40b593e58dd4f30faf7bbdaedb6327eae492581c4de907a68ba2dd26fb6f2a0b2c1e1b9d988ba0dd2b7bc14a7667364f80154'
7
+ data.tar.gz: dea62077b39e017f2924e213f9125159d1d54dc95bbe93862f56cad2263a511249d280ec87ea329fad9690653ab103a6a0658a111630d32d22403fda028f0046
@@ -1,19 +1,17 @@
1
+ ---
1
2
  version: 2
2
3
  updates:
3
4
  - package-ecosystem: bundler
4
5
  directory: /
5
6
  schedule:
6
- interval: daily
7
- time: "04:00"
7
+ interval: weekly
8
8
  open-pull-requests-limit: 10
9
9
  labels:
10
10
  - dependencies
11
11
 
12
- - package-ecosystem: "github-actions"
13
- directory: "/"
12
+ - package-ecosystem: github-actions
13
+ directory: /
14
14
  schedule:
15
- interval: "daily"
16
- time: "04:00"
17
- open-pull-requests-limit: 10
15
+ interval: weekly
18
16
  labels:
19
17
  - dependencies
@@ -1,4 +1,5 @@
1
- name: release
1
+ ---
2
+ name: Release
2
3
 
3
4
  on:
4
5
  workflow_dispatch:
@@ -10,7 +11,7 @@ jobs:
10
11
  release:
11
12
  runs-on: ubuntu-latest
12
13
  steps:
13
- - uses: actions/checkout@v4
14
+ - uses: actions/checkout@v5
14
15
  - name: Release Gem
15
16
  uses: cadwallion/publish-rubygems-action@94a6f4cd5350581749c569b5001eecc864e3ad0b
16
17
  env:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  name: Tests
2
3
 
3
4
  on:
@@ -14,10 +15,10 @@ jobs:
14
15
  - "3.1"
15
16
  - "3.2"
16
17
  - "3.3"
17
- platform: [ubuntu-latest]
18
- runs-on: ${{ matrix.platform }}
18
+ - "3.4"
19
+ runs-on: ubuntu-latest
19
20
  steps:
20
- - uses: actions/checkout@v4
21
+ - uses: actions/checkout@v5
21
22
  - name: Set up Ruby
22
23
  uses: ruby/setup-ruby@v1
23
24
  with:
@@ -26,4 +27,3 @@ jobs:
26
27
  run: bundle install
27
28
  - name: Run tests
28
29
  run: bundle exec rake
29
-
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ inherit_from:
2
2
  - .rubocop_opinionated.yml
3
3
  - .rubocop_todo.yml
4
4
 
5
- require:
5
+ plugins:
6
6
  - rubocop-rspec
7
7
 
8
8
  AllCops:
@@ -79,21 +79,11 @@ Style/Documentation:
79
79
  Layout/EmptyLines:
80
80
  Enabled: false
81
81
 
82
- # In most cases, a space is nice. Sometimes, it's not.
83
- # Just be consistent with the rest of the surrounding code.
84
- Layout/EmptyLinesAroundClassBody:
85
- Enabled: false
86
-
87
- # In most cases, a space is nice. Sometimes, it's not.
88
- # Just be consistent with the rest of the surrounding code.
89
- Layout/EmptyLinesAroundModuleBody:
90
- Enabled: false
91
-
92
82
  # This is quite buggy, as it doesn't recognize double lines.
93
83
  # Double empty lines are useful to separate conceptually different methods
94
84
  # in the same class or module.
95
85
  Layout/EmptyLineBetweenDefs:
96
- Enabled: false
86
+ NumberOfEmptyLines: [1, 2]
97
87
 
98
88
  # Annotated tokens (like %<foo>s) are a good thing, but in most cases we don't need them.
99
89
  # %s is a simpler and straightforward version that works in almost all cases. So don't complain.
@@ -123,13 +113,3 @@ Style/TrailingCommaInArrayLiteral:
123
113
  EnforcedStyleForMultiline: consistent_comma
124
114
  Style/TrailingCommaInHashLiteral:
125
115
  EnforcedStyleForMultiline: consistent_comma
126
-
127
- Style/TrivialAccessors:
128
- # IgnoreClassMethods because I want to be able to define class-level accessors
129
- # that sets an instance variable on the metaclass, such as:
130
- #
131
- # def self.default=(value)
132
- # @default = value
133
- # end
134
- #
135
- IgnoreClassMethods: true
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2024-11-22 13:51:42 UTC using RuboCop version 1.68.0.
3
+ # on 2025-08-19 11:02:59 UTC using RuboCop version 1.79.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -34,7 +34,6 @@ RSpec/MultipleExpectations:
34
34
  RSpec/NamedSubject:
35
35
  Exclude:
36
36
  - 'spec/whois/record_spec.rb'
37
- - 'spec/whois/server/socket_handler_spec.rb'
38
37
 
39
38
  # Offense count: 40
40
39
  RSpec/StubbedMock:
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.2.2
1
+ ruby 3.4.2
data/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
3
3
  This project uses [Semantic Versioning 2.0.0](http://semver.org/).
4
4
 
5
5
 
6
+ ## Release 6.0.3
7
+
8
+ ### Changed
9
+
10
+ - SERVER: Updated .CO (GH-669).
11
+ - SERVER: Updated .TR (GH-667).
12
+
13
+
14
+ ## Release 6.0.2
15
+
16
+ ### Changed
17
+
18
+ - SERVER: Updated .IN and other registry.in TLDs (GH-663).
19
+
20
+
6
21
  ## Release 6.0.1
7
22
 
8
23
  ### Changed
data/CONTRIBUTING.md CHANGED
@@ -4,37 +4,37 @@
4
4
 
5
5
  Fork, then clone the repo:
6
6
 
7
- ```
7
+ ```shell
8
8
  git clone git@github.com:your-username/whois.git
9
9
  ```
10
10
 
11
11
  Set up your machine:
12
12
 
13
- ```
13
+ ```shell
14
14
  bundle
15
15
  ```
16
16
 
17
17
  Make sure the tests pass:
18
18
 
19
- ```
19
+ ```shell
20
20
  bundle exec rake
21
21
  ```
22
22
 
23
23
  To propose a change/feature/patch, create your feature branch:
24
24
 
25
- ```
25
+ ```shell
26
26
  git checkout -b my-new-feature
27
27
  ```
28
28
 
29
29
  Make your change. Add tests for your change. Make the tests pass:
30
30
 
31
- ```
31
+ ```shell
32
32
  bundle exec rake
33
33
  ```
34
34
 
35
35
  Commit your changes:
36
36
 
37
- ```
37
+ ```shell
38
38
  git commit -am 'Add some feature'
39
39
  ```
40
40
 
data/Gemfile CHANGED
@@ -4,5 +4,5 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem "rubocop", require: false
8
- gem "rubocop-rspec", require: false
7
+ gem "rubocop", "~> 1.81.1", require: false
8
+ gem "rubocop-rspec", "~> 3.7.0", require: false
data/data/tld.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_": {
3
3
  "schema": "2",
4
- "updated": "2024-11-02 13:38:00 UTC"
4
+ "updated": "2025-10-15 09:25:00 UTC"
5
5
  },
6
6
  "aaa": {
7
7
  "_type": "newgtld",
@@ -1040,7 +1040,7 @@
1040
1040
  "adapter": "none"
1041
1041
  },
1042
1042
  "co": {
1043
- "host": "whois.nic.co"
1043
+ "host": "whois.registry.co"
1044
1044
  },
1045
1045
  "coach": {
1046
1046
  "_type": "newgtld",
@@ -2488,7 +2488,7 @@
2488
2488
  "host": "whois.nic.immobilien"
2489
2489
  },
2490
2490
  "in": {
2491
- "host": "whois.registry.in"
2491
+ "host": "whois.nixiregistry.in"
2492
2492
  },
2493
2493
  "inc": {
2494
2494
  "_type": "newgtld",
@@ -4952,7 +4952,7 @@
4952
4952
  "host": "whois.nic.toys"
4953
4953
  },
4954
4954
  "tr": {
4955
- "host": "whois.nic.tr"
4955
+ "host": "whois.trabis.gov.tr"
4956
4956
  },
4957
4957
  "trade": {
4958
4958
  "_type": "newgtld",
@@ -5042,18 +5042,12 @@
5042
5042
  "uk": {
5043
5043
  "host": "whois.nic.uk"
5044
5044
  },
5045
- // "ac.uk": {
5046
- // "host": "whois.nic.ac.uk"
5047
- // },
5048
5045
  "bl.uk": {
5049
5046
  "adapter": "none"
5050
5047
  },
5051
5048
  "british-library.uk": {
5052
5049
  "adapter": "none"
5053
5050
  },
5054
- // "gov.uk": {
5055
- // "host": "whois.gov.uk"
5056
- // },
5057
5051
  "icnet.uk": {
5058
5052
  "adapter": "none"
5059
5053
  },
@@ -5420,7 +5414,7 @@
5420
5414
  },
5421
5415
  "xn--2scrj9c": {
5422
5416
  "_type": "newgtld",
5423
- "host": "whois.registry.in"
5417
+ "host": "whois.nixiregistry.in"
5424
5418
  },
5425
5419
  "xn--30rr7y": {
5426
5420
  "_type": "newgtld",
@@ -5438,7 +5432,7 @@
5438
5432
  "host": "whois.kr"
5439
5433
  },
5440
5434
  "xn--3hcrj9c": {
5441
- "host": "whois.registry.in"
5435
+ "host": "whois.nixiregistry.in"
5442
5436
  },
5443
5437
  "xn--3oq18vl8pn36a": {
5444
5438
  "_type": "newgtld",
@@ -5454,10 +5448,10 @@
5454
5448
  },
5455
5449
  "xn--45br5cyl": {
5456
5450
  "_type": "newgtld",
5457
- "host": "whois.registry.in"
5451
+ "host": "whois.nixiregistry.in"
5458
5452
  },
5459
5453
  "xn--45brj9c": {
5460
- "host": "whois.registry.in"
5454
+ "host": "whois.nixiregistry.in"
5461
5455
  },
5462
5456
  "xn--45q11c": {
5463
5457
  "_type": "newgtld",
@@ -5623,7 +5617,7 @@
5623
5617
  "host": "whois.nic.google"
5624
5618
  },
5625
5619
  "xn--fpcrj9c3d": {
5626
- "host": "whois.registry.in"
5620
+ "host": "whois.nixiregistry.in"
5627
5621
  },
5628
5622
  "xn--fzc2c9e2c": {
5629
5623
  "host": "whois.nic.lk"
@@ -5641,7 +5635,7 @@
5641
5635
  "adapter": "none"
5642
5636
  },
5643
5637
  "xn--gecrj9c": {
5644
- "host": "whois.registry.in"
5638
+ "host": "whois.nixiregistry.in"
5645
5639
  },
5646
5640
  "xn--gk3at1e": {
5647
5641
  "_type": "newgtld",
@@ -5649,14 +5643,14 @@
5649
5643
  },
5650
5644
  "xn--h2breg3eve": {
5651
5645
  "_type": "newgtld",
5652
- "host": "whois.registry.in"
5646
+ "host": "whois.nixiregistry.in"
5653
5647
  },
5654
5648
  "xn--h2brj9c": {
5655
- "host": "whois.registry.in"
5649
+ "host": "whois.nixiregistry.in"
5656
5650
  },
5657
5651
  "xn--h2brj9c8c": {
5658
5652
  "_type": "newgtld",
5659
- "host": "whois.registry.in"
5653
+ "host": "whois.nixiregistry.in"
5660
5654
  },
5661
5655
  "xn--hxt814e": {
5662
5656
  "_type": "newgtld",
@@ -5753,10 +5747,10 @@
5753
5747
  },
5754
5748
  "xn--mgbbh1a": {
5755
5749
  "_type": "newgtld",
5756
- "host": "whois.registry.in"
5750
+ "host": "whois.nixiregistry.in"
5757
5751
  },
5758
5752
  "xn--mgbbh1a71e": {
5759
- "host": "whois.registry.in"
5753
+ "host": "whois.nixiregistry.in"
5760
5754
  },
5761
5755
  "xn--mgbc0a9azcg": {
5762
5756
  "adapter": "none"
@@ -5770,7 +5764,7 @@
5770
5764
  },
5771
5765
  "xn--mgbgu82a": {
5772
5766
  "_type": "newgtld",
5773
- "host": "whois.registry.in"
5767
+ "host": "whois.nixiregistry.in"
5774
5768
  },
5775
5769
  "xn--mgbi4ecexp": {
5776
5770
  "_type": "newgtld",
@@ -5872,10 +5866,10 @@
5872
5866
  },
5873
5867
  "xn--rvc1e0am3e": {
5874
5868
  "_type": "newgtld",
5875
- "host": "whois.registry.in"
5869
+ "host": "whois.nixiregistry.in"
5876
5870
  },
5877
5871
  "xn--s9brj9c": {
5878
- "host": "whois.registry.in"
5872
+ "host": "whois.nixiregistry.in"
5879
5873
  },
5880
5874
  "xn--ses554g": {
5881
5875
  "_type": "newgtld",
@@ -5935,7 +5929,7 @@
5935
5929
  "host": "whois.nic.lk"
5936
5930
  },
5937
5931
  "xn--xkc2dl3a5ee0h": {
5938
- "host": "whois.registry.in"
5932
+ "host": "whois.nixiregistry.in"
5939
5933
  },
5940
5934
  "xn--y9a3aq": {
5941
5935
  "host": "whois.amnic.net"
data/lib/whois/client.rb CHANGED
@@ -13,9 +13,7 @@ require "timeout"
13
13
 
14
14
 
15
15
  module Whois
16
-
17
16
  class Client
18
-
19
17
  # The maximum time to run a WHOIS query, expressed in seconds.
20
18
  #
21
19
  # @return [Fixnum] Timeout value in seconds.
@@ -96,7 +94,5 @@ module Whois
96
94
  @server.lookup(string)
97
95
  end
98
96
  end
99
-
100
97
  end
101
-
102
98
  end
data/lib/whois/errors.rb CHANGED
@@ -10,7 +10,6 @@
10
10
 
11
11
 
12
12
  module Whois
13
-
14
13
  # The base error class for all <tt>Whois</tt> error classes.
15
14
  class Error < StandardError
16
15
  end
@@ -73,7 +72,6 @@ module Whois
73
72
  # standard WHOIS interface via port 43. This is the case of some
74
73
  # specific domains that only provide a web-based WHOIS interface. (\x01)
75
74
  class WebInterfaceError < InterfaceNotSupported
76
-
77
75
  # @return [String] The URL of the web-based WHOIS interface.
78
76
  attr_reader :url
79
77
 
@@ -84,9 +82,7 @@ module Whois
84
82
  @url = url
85
83
  super("This TLD has no WHOIS server, but you can access the WHOIS database at `#{@url}'")
86
84
  end
87
-
88
85
  end
89
86
 
90
87
  # @!endgroup
91
-
92
88
  end
@@ -11,7 +11,6 @@
11
11
 
12
12
  module Whois
13
13
  class Record
14
-
15
14
  # A single {Whois::Record} fragment. For instance,
16
15
  # in case of *thin server*, a {Whois::Record} can be composed by
17
16
  # one or more parts corresponding to all responses
@@ -42,6 +41,5 @@ module Whois
42
41
  end
43
42
  end
44
43
  end
45
-
46
44
  end
47
45
  end
data/lib/whois/record.rb CHANGED
@@ -13,10 +13,7 @@ require "whois/record/part"
13
13
 
14
14
 
15
15
  module Whois
16
-
17
16
  class Record
18
-
19
-
20
17
  # @return [Whois::Server] The server that originated this record.
21
18
  attr_reader :server
22
19
 
@@ -113,7 +110,5 @@ module Whois
113
110
  def content
114
111
  @content ||= parts.map(&:body).join("\n")
115
112
  end
116
-
117
113
  end
118
-
119
114
  end
@@ -12,14 +12,12 @@
12
12
  module Whois
13
13
  class Server
14
14
  module Adapters
15
-
16
15
  #
17
16
  # = Afilias Adapter
18
17
  #
19
18
  # Provides ability to query Afilias WHOIS interfaces.
20
19
  #
21
20
  class Afilias < Base
22
-
23
21
  # Executes a WHOIS query to the Afilias WHOIS interface,
24
22
  # resolving any intermediate referral,
25
23
  # and appends the response to the client buffer.
@@ -46,9 +44,7 @@ module Whois
46
44
  server = match[match.size - 1].strip
47
45
  server.empty? ? nil : server
48
46
  end
49
-
50
47
  end
51
-
52
48
  end
53
49
  end
54
50
  end
@@ -12,14 +12,12 @@
12
12
  module Whois
13
13
  class Server
14
14
  module Adapters
15
-
16
15
  #
17
16
  # = Arin Adapter
18
17
  #
19
18
  # Provides ability to query Arin WHOIS interfaces.
20
19
  #
21
20
  class Arin < Base
22
-
23
21
  # Executes a WHOIS query to the Arin WHOIS interface,
24
22
  # resolving any intermediate referral,
25
23
  # and appends the response to the client buffer.
@@ -47,9 +45,7 @@ module Whois
47
45
  port: Regexp.last_match(2)&.to_i,
48
46
  }
49
47
  end
50
-
51
48
  end
52
-
53
49
  end
54
50
  end
55
51
  end
@@ -12,9 +12,7 @@
12
12
  module Whois
13
13
  class Server
14
14
  module Adapters
15
-
16
15
  class Arpa < Base
17
-
18
16
  def request(string)
19
17
  record = Server.guess(inaddr_to_ip(string)).lookup(string)
20
18
  part = record.parts.first
@@ -35,14 +33,12 @@ module Whois
35
33
  a, b, c, d = string.scan(/[0-9]{1,3}\./).reverse
36
34
  [a, b, c, d].map do |token|
37
35
  token = (token || 0).to_i
38
- raise ServerError, "Invalid .in-addr.arpa token `#{token}'" unless token <= 255 && token >= 0
36
+ raise ServerError, "Invalid .in-addr.arpa token `#{token}'" unless token.between?(0, 255)
39
37
 
40
38
  token
41
39
  end.join(".")
42
40
  end
43
-
44
41
  end
45
-
46
42
  end
47
43
  end
48
44
  end
@@ -17,7 +17,6 @@ require "whois/server/socket_handler"
17
17
  module Whois
18
18
  class Server
19
19
  module Adapters
20
-
21
20
  class Base
22
21
  class << self
23
22
  def query_handler
@@ -170,9 +169,7 @@ module Whois
170
169
  end
171
170
 
172
171
  alias query_the_socket query
173
-
174
172
  end
175
-
176
173
  end
177
174
  end
178
175
  end
@@ -12,7 +12,6 @@
12
12
  module Whois
13
13
  class Server
14
14
  module Adapters
15
-
16
15
  #
17
16
  # = Formatted Adapter
18
17
  #
@@ -34,7 +33,6 @@ module Whois
34
33
  # @see Whois::Server::Adapters::Standard
35
34
  #
36
35
  class Formatted < Base
37
-
38
36
  # Executes a WHOIS query to the WHOIS interface
39
37
  # listening at +host+ and appends the response
40
38
  # to the client buffer.
@@ -52,9 +50,7 @@ module Whois
52
50
  response = query_the_socket(format(options[:format], string), host)
53
51
  buffer_append response, host
54
52
  end
55
-
56
53
  end
57
-
58
54
  end
59
55
  end
60
56
  end
@@ -12,7 +12,6 @@
12
12
  module Whois
13
13
  class Server
14
14
  module Adapters
15
-
16
15
  #
17
16
  # = None Adapter
18
17
  #
@@ -28,7 +27,6 @@ module Whois
28
27
  # adapter raises a {Whois::NoInterfaceError} exception.
29
28
  #
30
29
  class None < Base
31
-
32
30
  # Always raises a {Whois::NoInterfaceError} exception.
33
31
  #
34
32
  # @param [String] string
@@ -39,9 +37,7 @@ module Whois
39
37
  def request(_string)
40
38
  raise NoInterfaceError, "This `#{type}' has no whois server"
41
39
  end
42
-
43
40
  end
44
-
45
41
  end
46
42
  end
47
43
  end
@@ -12,9 +12,7 @@
12
12
  module Whois
13
13
  class Server
14
14
  module Adapters
15
-
16
15
  class NotImplemented < Base
17
-
18
16
  # Always raises a {Whois::ServerNotImplemented} exception.
19
17
  #
20
18
  # @param [String] string
@@ -25,9 +23,7 @@ module Whois
25
23
  def request(_string)
26
24
  raise ServerNotImplemented, "The `#{host}' feature has not been implemented yet."
27
25
  end
28
-
29
26
  end
30
-
31
27
  end
32
28
  end
33
29
  end
@@ -12,7 +12,6 @@
12
12
  module Whois
13
13
  class Server
14
14
  module Adapters
15
-
16
15
  #
17
16
  # = Standard Adapter
18
17
  #
@@ -38,7 +37,6 @@ module Whois
38
37
  # * +:port+ - Specifies a port number different than 43
39
38
  #
40
39
  class Standard < Base
41
-
42
40
  # Executes a WHOIS query to the WHOIS interface
43
41
  # listening at +host+ and appends the response
44
42
  # to the client buffer.
@@ -53,9 +51,7 @@ module Whois
53
51
  response = query_the_socket(string, host)
54
52
  buffer_append response, host
55
53
  end
56
-
57
54
  end
58
-
59
55
  end
60
56
  end
61
57
  end
@@ -12,14 +12,12 @@
12
12
  module Whois
13
13
  class Server
14
14
  module Adapters
15
-
16
15
  #
17
16
  # = Verisign Adapter
18
17
  #
19
18
  # Provides ability to query Verisign WHOIS interfaces.
20
19
  #
21
20
  class Verisign < Base
22
-
23
21
  # Executes a WHOIS query to the Verisign WHOIS interface,
24
22
  # resolving any intermediate referral,
25
23
  # and appends the response to the client buffer.
@@ -46,9 +44,7 @@ module Whois
46
44
  server = match[match.size - 1].strip
47
45
  server.empty? ? nil : server
48
46
  end
49
-
50
47
  end
51
-
52
48
  end
53
49
  end
54
50
  end
@@ -12,7 +12,6 @@
12
12
  module Whois
13
13
  class Server
14
14
  module Adapters
15
-
16
15
  #
17
16
  # = Web Adapter
18
17
  #
@@ -23,7 +22,6 @@ module Whois
23
22
  # adapter, just a little bit more specific.
24
23
  #
25
24
  class Web < Base
26
-
27
25
  # Always raises a {Whois::WebInterfaceError} exception
28
26
  # including the web address for the WHOIS inteface.
29
27
  #
@@ -35,9 +33,7 @@ module Whois
35
33
  def request(_string)
36
34
  raise WebInterfaceError, options[:url]
37
35
  end
38
-
39
36
  end
40
-
41
37
  end
42
38
  end
43
39
  end
@@ -15,12 +15,10 @@ require "whois/errors"
15
15
 
16
16
  module Whois
17
17
  class Server
18
-
19
18
  # The SocketHandler is the default query handler provided with the
20
19
  # Whois library. It performs the WHOIS query using a synchronous
21
20
  # socket connection.
22
21
  class SocketHandler
23
-
24
22
  # Array of connection errors to rescue
25
23
  # and wrap into a {Whois::ConnectionError}
26
24
  RESCUABLE_CONNECTION_ERRORS = [
@@ -61,6 +59,5 @@ module Whois
61
59
  client&.close # If != client something went wrong.
62
60
  end
63
61
  end
64
-
65
62
  end
66
63
  end
data/lib/whois/server.rb CHANGED
@@ -24,14 +24,12 @@ require "whois/server/adapters/web"
24
24
 
25
25
 
26
26
  module Whois
27
-
28
27
  # The {Whois::Server} class has two important roles:
29
28
  #
30
29
  # 1. it acts as a database for the WHOIS server definitions
31
30
  # 2. it is responsible for selecting the right adapter used to handle the query to the WHOIS server(s).
32
31
  #
33
32
  class Server
34
-
35
33
  # The {Whois::Server::Adapters} module is a namespace for all
36
34
  # WHOIS server adapters. Each adapter is a subclass of {Whois::Server::Adapters::Base},
37
35
  # customized to handle WHOIS queries for a type or a group of servers.
@@ -52,7 +50,6 @@ module Whois
52
50
  private_constant :EMPTY_HASH
53
51
 
54
52
  class << self
55
-
56
53
  # Clears the definition and reset them to an empty list.
57
54
  #
58
55
  # @return [void]
@@ -390,10 +387,8 @@ module Whois
390
387
 
391
388
  false
392
389
  end
393
-
394
390
  end
395
391
  end
396
-
397
392
  end
398
393
 
399
394
  Whois::Server.load_definitions
data/lib/whois/version.rb CHANGED
@@ -11,5 +11,5 @@
11
11
 
12
12
  module Whois
13
13
  # The current library version.
14
- VERSION = "6.0.1"
14
+ VERSION = "6.0.3"
15
15
  end
data/lib/whois.rb CHANGED
@@ -17,9 +17,7 @@ require "whois/record"
17
17
 
18
18
 
19
19
  module Whois
20
-
21
20
  class << self
22
-
23
21
  # Queries the WHOIS server for <tt>object</tt> and returns
24
22
  # the response from the server.
25
23
  #
@@ -120,5 +118,4 @@ module Whois
120
118
  end
121
119
  end
122
120
  end
123
-
124
121
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RSpecSupportSpecHelpers
4
-
5
4
  def fixture(*names)
6
5
  File.join(SPEC_ROOT, "fixtures", *names)
7
6
  end
@@ -25,7 +24,6 @@ module RSpecSupportSpecHelpers
25
24
  def definitions_teardown
26
25
  Whois::Server.send :instance_variable_set, :@definitions, @_definitions
27
26
  end
28
-
29
27
  end
30
28
 
31
29
  RSpec.configure do |config|
@@ -7,9 +7,11 @@ describe Whois::Server::SocketHandler do
7
7
  describe "#call" do
8
8
  [Errno::ECONNRESET, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EPIPE, SocketError].each do |error|
9
9
  it "re-raises #{error} as Whois::ConnectionError" do
10
- expect(subject).to receive(:execute).and_raise(error)
10
+ handler = described_class.new
11
+ expect(handler).to receive(:execute).and_raise(error)
12
+
11
13
  expect {
12
- subject.call("example.test", "whois.test", 43)
14
+ handler.call("example.test", "whois.test", 43)
13
15
  }.to raise_error(Whois::ConnectionError, "#{error}: #{error.new.message}")
14
16
  end
15
17
 
@@ -22,7 +24,9 @@ describe Whois::Server::SocketHandler do
22
24
  expect(TCPSocket).to receive(:new)
23
25
  .with("whois.test", 43)
24
26
  .and_return(socket)
25
- subject.call("example.test", "whois.test", 43)
27
+
28
+ handler = described_class.new
29
+ handler.call("example.test", "whois.test", 43)
26
30
  end
27
31
  end
28
32
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whois
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simone Carletti
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -61,12 +60,11 @@ executables:
61
60
  - whoisrb
62
61
  extensions: []
63
62
  extra_rdoc_files:
64
- - LICENSE.txt
65
63
  - ".yardopts"
64
+ - LICENSE.txt
66
65
  files:
67
66
  - ".github/FUNDING.yml"
68
67
  - ".github/dependabot.yml"
69
- - ".github/workflows/codeql-analysis.yml"
70
68
  - ".github/workflows/release.yml"
71
69
  - ".github/workflows/tests.yml"
72
70
  - ".gitignore"
@@ -77,7 +75,6 @@ files:
77
75
  - ".simplecov"
78
76
  - ".tool-versions"
79
77
  - ".yardopts"
80
- - 4.0-Upgrade.md
81
78
  - CHANGELOG.md
82
79
  - CONTRIBUTING.md
83
80
  - Gemfile
@@ -152,7 +149,6 @@ homepage: https://whoisrb.org/
152
149
  licenses:
153
150
  - MIT
154
151
  metadata: {}
155
- post_install_message:
156
152
  rdoc_options: []
157
153
  require_paths:
158
154
  - lib
@@ -167,8 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
163
  - !ruby/object:Gem::Version
168
164
  version: '0'
169
165
  requirements: []
170
- rubygems_version: 3.5.22
171
- signing_key:
166
+ rubygems_version: 3.6.9
172
167
  specification_version: 4
173
168
  summary: An intelligent pure Ruby WHOIS client and parser.
174
169
  test_files: []
@@ -1,64 +0,0 @@
1
- # For most projects, this workflow file will not need changing; you simply need
2
- # to commit it to your repository.
3
- #
4
- # You may wish to alter this file to override the set of languages analyzed,
5
- # or to provide custom queries or build logic.
6
- name: "CodeQL"
7
-
8
- on:
9
- push:
10
- branches: [ main ]
11
- pull_request:
12
- # The branches below must be a subset of the branches above
13
- branches: [ main ]
14
- schedule:
15
- - cron: '39 4 * * 0'
16
-
17
- jobs:
18
- analyze:
19
- name: Analyze
20
- runs-on: ubuntu-latest
21
- permissions:
22
- actions: read
23
- contents: read
24
- security-events: write
25
-
26
- strategy:
27
- fail-fast: false
28
- matrix:
29
- language: [ 'ruby' ]
30
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
31
- # Learn more about CodeQL language support at https://git.io/codeql-language-support
32
-
33
- steps:
34
- - name: Checkout repository
35
- uses: actions/checkout@v4
36
-
37
- # Initializes the CodeQL tools for scanning.
38
- - name: Initialize CodeQL
39
- uses: github/codeql-action/init@v3
40
- with:
41
- languages: ${{ matrix.language }}
42
- # If you wish to specify custom queries, you can do so here or in a config file.
43
- # By default, queries listed here will override any specified in a config file.
44
- # Prefix the list here with "+" to use these queries and those in the config file.
45
- # queries: ./path/to/local/query, your-org/your-repo/queries@main
46
-
47
- # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
48
- # If this step fails, then you should remove it and run the build manually (see below)
49
- - name: Autobuild
50
- uses: github/codeql-action/autobuild@v3
51
-
52
- # ℹ️ Command-line programs to run using the OS shell.
53
- # 📚 https://git.io/JvXDl
54
-
55
- # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
56
- # and modify them (or add more) to build your code if your project
57
- # uses a compiled language
58
-
59
- #- run: |
60
- # make bootstrap
61
- # make release
62
-
63
- - name: Perform CodeQL Analysis
64
- uses: github/codeql-action/analyze@v3
data/4.0-Upgrade.md DELETED
@@ -1,143 +0,0 @@
1
- # Welcome to Whois 4.0!
2
-
3
- Whois 4 is a major upgrade compared to Whois 3. This library is now 7 years old, enough mature to offer pretty much all the features you need to perform WHOIS queries.
4
-
5
- In these last 7 years the adoption of this library has grown beyond any expectation. Most of the time was spent updating the definitions to stay up to date with the various registrar changes (thanks ICANN for thew newGLTDs...), updating the registry parsers and polishing up the public interface.
6
-
7
- For Whois 4 I decided to take a step back, and rewrite some of the internal components of this library to improve performance and readability. As a result of these changes, there are several compatibility breaks with Whois 4 that I'm going to document here.
8
-
9
- -- Simone
10
-
11
- ## What's New
12
-
13
- - The Whois client and the Whois parser are now two separate repositories, and they are also distributed as two separate gems:
14
-
15
- - https://github.com/weppos/whois - https://rubygems.org/gems/whois
16
- - https://github.com/weppos/whois-parser https://rubygems.org/gems/whois-parser
17
-
18
- There are several reasons behind this change (see [weppos/whois#503](https://github.com/weppos/whois/pull/503)).
19
-
20
- First of all, the maintenance of the whois-parser component is the most time consuming task. Updating a parser may require from a few minutes to several hours, depending on how big are the changes. It also requires to generate the appropriate fixtures, and write the necessary tests. In the last years I noticed that more than once client updates were delayed because of pending parser changes. Separating the repositories and the release cycles will likely speedup future released of the client gem.
21
-
22
- Moreover, the parser component takes a lot of space (due to all the files and fixtures). If you just need a Ruby whois client, loading the entire parser component is inefficient and a waste of time/CPU/resources.
23
-
24
- Last but not least, in the last years the Whois client inspired several ports in different languages. Most of these ports were not interested in porting the parser as well. However, the parser was so tightly coupled with the client that it made the client code harder to read.
25
-
26
- - The definition files have been largely redesigned, in particular the TLD file. The definitions are now maintained using a set of CLI tools. The goal is to eventually extract the definition files into a separate, standalone repository that other WHOIS libraries can easily fetch.
27
-
28
- ## Upgrade
29
-
30
- When upgrading, here's the most relevant changes to keep an eye on:
31
-
32
- - If you are using the Whois parser, install and require the `whois-parser` gem. The parser will automatically download the appropriate `whois` dependency.
33
-
34
- ```ruby
35
- require 'whois-parser'
36
- ```
37
-
38
- If you only need the client and you don't care about the parser, simply continue to require the `whois` gem directly.
39
-
40
- ```ruby
41
- require 'whois'
42
- ```
43
-
44
- - `Whois::Server.definitions` no longer return the internal definitions. Definitions are no longer accessible directly, because their internal representation may change at any time. If you need to modify the definitions, use the public API.
45
-
46
- ```ruby
47
- Whois::Server.define(Whois::Server::TYPE_TLD, ...)
48
- ```
49
-
50
- You can still use `Whois::Server.definitions`, but it will return a copy of the internal definitions, and you have to specify which type of definitions you want to access.
51
-
52
- ```ruby
53
- Whois::Server.definitions(Whois::Server::TYPE_TLD)
54
- ```
55
-
56
- - **The parser methods are no longer accessible directly within the response object.**
57
-
58
- This is probably one of the most important changes, and it is explained in details at [weppos/whois-parser#5](https://github.com/weppos/whois-parser/pull/5).
59
-
60
- In Whois 3, you can invoke a property method on a record object and the record will automatically route the method call to the underlying parser. If the property is not supported or defined in any of the parsers, then the method will return nil.
61
-
62
- However, this behavior is often the cause of confusion and misunderstandings, especially for partially implemented parsers. Without to mention that the code required for this feature to work added an extra layer of complexity to the `Whois::Record` implementation.
63
-
64
- Starting from Whois 4, the `Whois::Record` doesn't expose any parsing methods anymore. If you want to parse a record, you have to istantiate a parser manually. Of course, you also need to use the `whois-parser` library instead of `whois`.
65
-
66
- Whois 3:
67
-
68
- ```ruby
69
- require 'whois-parser'
70
-
71
- record = Whois.whois("example.it")
72
- record.expires_on
73
- ```
74
-
75
- Whois 4:
76
-
77
- ```ruby
78
- require 'whois-parser'
79
-
80
- record = Whois.whois("example.it")
81
- parser = Whois::Parser.new(record)
82
- parser.expires_on
83
- ```
84
-
85
- You can still use the convenient helper `record.parser` to initialize a parser:
86
-
87
- ```ruby
88
- require 'whois-parser'
89
-
90
- record = Whois.whois("example.it")
91
- record.parser.expires_on
92
- ```
93
-
94
- Also note that any parser method, such as `parser.expires_on`, will raise an error if the property is not implemented, as opposite to silently returning `nil` as it was in Whois 3.
95
-
96
- - **Parser extensions**
97
-
98
- The Parser features available in Whois 3 has been packaged into several extensions. Some of them are loaded by default in Whois 4 when you require `whois-parser`, others not anymore. The reason is because although some of them may appear convenient (because it makes you write more code), it turned out that they made some assumptions that were often source of confusion.
99
-
100
- Check the header of the [`whois/parser.rb`](https://github.com/weppos/whois-parser/blob/master/lib/whois/parser.rb) file to learn more about the purpose of each extension.
101
-
102
- Requiring **all** the extensions will essentially force Whois 4 to work pretty much like Whois 3. This is not recommended, and you should not rely on those extensions to be there forever. Instead, you should write the code depending on what you actually need.
103
-
104
- There is also an ENV variable you can set to rollback compatibility to Whois 3.
105
-
106
- ```ruby
107
- ENV["WHOISRB_4EXTENSIONS"] = 1
108
- ```
109
-
110
- Again, this flag exists only as temporary helper, and it should not become a permanent upgrade workaround.
111
-
112
- - **SafeRecord**
113
-
114
- In the previous point I mentioned that you should write the code you need to customize the `Whois::Record` and extract information with the `Whois::Parser`. However, I omitted an important additional recommendation: avoid monkey patching the Whois::Record object, and instead prefer composition via delegation.
115
-
116
- The SafeRecord is an example of a wrapper around a Record object, that expose a Whois 3 alike interface, without injecting the parser methods directly into the `Whois::Record` itself.
117
-
118
- The advantages are:
119
-
120
- - the code is more maintainable, as it is not tighlty coupled to the Whois::Record
121
- - you don't monkey patch `Whois::Record` in your code, which is an object you don't have control of because it is packaged in a third party library (and can change)
122
- - the library can easily be tested separately
123
-
124
- In these 10 years of writing Ruby code, I've noticed an increasing attitude to monkey patch Ruby classes you don't control, instead of writing your own code and delegate to them. It looks like in several cases Ruby programmers are afraid of writing Ruby code. This results in very fragile code, where methods can easily conflict each other (especially between dependencies).
125
-
126
- The `Whois::SafeRecord` is an alternative example of how you can restore Whois 3 behavior by using a custom object.
127
-
128
- ```ruby
129
- require 'whois/parser'
130
- require 'whois/safe_record'
131
-
132
- record = Whois.whois('example.com')
133
- record.disclaimer
134
- # => Whois::AttributeNotSupported
135
-
136
- safe_record = Whois::SafeRecord.new(record)
137
- safe_record.disclaimer
138
- # => nil
139
- ```
140
-
141
- This is preferred over requiring the `whois/parser_extensions` or enabling v3 compatibility mode.
142
-
143
- Please note that the parser extension is provided as example. It may be removed from future versions therefore, once again, you should write the code you need to access the parsed data.