net-ping 2.1.1 → 2.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12d4bcbcdb97fb3b116be13a5bc7ad632b4efc116127d9b5859531b5605be3ae
4
- data.tar.gz: 22603f15d676ac4e3a4137a0bdec76019b7a52b8ae5ca028b452b8760ad6bd15
3
+ metadata.gz: cde6d53c546914dc2150eb754a1d0b79ca1391b8a4c10be31ef161ff1d94a13d
4
+ data.tar.gz: b8cad0dbe1bd739e4407c03fdd72aa05e6a5152bed56fe8c0d7b450f0bf84b59
5
5
  SHA512:
6
- metadata.gz: ab74625d886822f7801e5c9c6e7704664bb789f745b47a29ec54cf8e7baa4cbb1a86c332df8bc16a4757900987dc3389642c290cf4d38d98badbc1e60df7ffa1
7
- data.tar.gz: bb55d09ac91ec4ac1e407e7050f655d7fd305f3fcab3fa2093613745509724d138b25b22282d2d00d63eb5880d50814d7bfe0ac4d9e414904fbeb2d0e2618ec5
6
+ metadata.gz: 324fb64066295878e20c61bd2dd4bfefd82d6171a1ede99bead3c407cd9388012673e4d99245591ed188b48a59b2d6371dc15b0d9c8db549affcdf870a67adfe
7
+ data.tar.gz: c6fdb6bd7c15ef6ae6c3fcdf78e8bf55ca9d2f6c95b6373a9c2eb9dee22ea7b220eccf92c4ad023809d84425fe06e8b18fd54b60918152199536dc26c7ca612c
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ == 2.2.0 - 22-Sep-2026
2
+ * Add support for HTTP to ping URLs requiring a query parameter, carrying
3
+ forward #25 by Kenneth Perry (@thothonegan)
4
+ [#50](https://github.com/eitoball/net-ping/pull/50).
5
+
1
6
  == 2.1.1 - 16-Aug-2026
2
7
  * Fix the license format in net-ping.gemspec to use the SPDX identifier
3
8
  "Artistic-2.0" [#47](https://github.com/eitoball/net-ping/pull/47).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- net-ping (2.1.1)
4
+ net-ping (2.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/net/ping/http.rb CHANGED
@@ -149,7 +149,7 @@ module Net
149
149
  proxy = uri.find_proxy || URI.parse("")
150
150
 
151
151
  begin
152
- uri_path = uri.path.empty? ? '/' : uri.path
152
+ uri_path = uri.request_uri
153
153
 
154
154
  headers = {}
155
155
  headers["User-Agent"] = user_agent if user_agent
@@ -1,6 +1,6 @@
1
1
  module Net
2
2
  class Ping
3
3
  # The version of the net-ping library.
4
- VERSION = '2.1.1'
4
+ VERSION = '2.2.0'
5
5
  end
6
6
  end
@@ -12,6 +12,10 @@ class TC_Net_Ping_HTTP < Test::Unit::TestCase
12
12
  def setup
13
13
  ENV['http_proxy'] = ENV['https_proxy'] = ENV['no_proxy'] = nil
14
14
  @uri = 'http://www.google.com/index.html'
15
+ @uri_without_query = 'https://play.google.com/store/apps/details'
16
+ @uri_with_query = 'https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox'
17
+ @uri_empty_path_with_query = 'http://empty-path-query.com?foo=bar'
18
+
15
19
  @uri_https = 'https://encrypted.google.com'
16
20
  @uri_http_domain = 'http.com'
17
21
  @uri_http_domain_scheme = 'http://http.com'
@@ -21,6 +25,9 @@ class TC_Net_Ping_HTTP < Test::Unit::TestCase
21
25
 
22
26
  stub_request(:get, @uri).to_return(body: "PONG")
23
27
  stub_request(:head, @uri).to_return(body: "PONG")
28
+ stub_request(:get, @uri_with_query).to_return(body: "PONG")
29
+ stub_request(:head, @uri_with_query).to_return(body: "PONG")
30
+ stub_request(:head, "http://empty-path-query.com/?foo=bar").to_return(body: "PONG")
24
31
  stub_request(:head, @uri_https).to_return(body: "PONG")
25
32
  stub_request(:get, @uri_https).to_return(body: "PONG")
26
33
  stub_request(:get, "http://#{@uri_http_domain}").to_return(body: "PONG")
@@ -233,6 +240,21 @@ class TC_Net_Ping_HTTP < Test::Unit::TestCase
233
240
  assert_true(@http.ping)
234
241
  end
235
242
 
243
+ test 'ping_with_query' do
244
+ # without query doesn't work, but with query does
245
+ @http = Net::Ping::HTTP.new(@uri_without_query)
246
+ assert_false(@http.ping)
247
+
248
+ @http = Net::Ping::HTTP.new(@uri_with_query)
249
+ assert_true(@http.ping)
250
+ end
251
+
252
+ test 'ping preserves query string when the path is empty' do
253
+ @http = Net::Ping::HTTP.new(@uri_empty_path_with_query)
254
+ assert_true(@http.ping)
255
+ assert_requested(:head, "http://empty-path-query.com/?foo=bar")
256
+ end
257
+
236
258
  test 'ping with http proxy' do
237
259
  ENV['http_proxy'] = "http://proxymoxie:3128"
238
260
  @http = Net::Ping::HTTP.new(@uri)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ping
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Chernesky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-16 00:00:00.000000000 Z
11
+ date: 2026-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit