fingerprinter 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fingerprinter.rb +17 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e23aed5ef3ed13d6d87ce5c9a60f8ae7c76b1af3072e5743e2d2fe97613c69a0
4
- data.tar.gz: 5fdd5658a3eef4660f3c7274065e409b47e602c4a3f213c90de0bc002f052688
3
+ metadata.gz: 8f6821303bf8854c4b159cc1038bfb08af71d170b07a24e19376f49f88bba6ee
4
+ data.tar.gz: edd7faad955013acf5c94e897e4994e340baafc493c3f2c1bfccdb2bf7558f7c
5
5
  SHA512:
6
- metadata.gz: 80134337a1020a483c849b4e54944531cf414a47325e8b51365f95bfebaaac8beab2b9b8e963f76a05a6cc218b57fb7c45756cfdf54bf6bba616919e7f2bab46
7
- data.tar.gz: a4d1599414026b37d11628e6c84abba00c071c05857ee4ca9b833149fe3f8a81a384f6d4b0fe10f36833b8bbd0d0dfd7afd21566ca177476c71865dd5a38902b
6
+ metadata.gz: 711d27cdd3329f07e6e24daa9400e36a8e8f62c6467870c0dc0309ed75bd1aa9713aaede490b9c882e91e1e69d8b9ccb0c20077f6e42a00353b03db685483078
7
+ data.tar.gz: 49b065930036587200a211e12337e67bd6a61643e0101c9e2ddb860bc5454542ce74fb33557a4ac830dfa27159410ea2317eee8f751ed49848265a8bc4834bb0
data/lib/fingerprinter.rb CHANGED
@@ -59,11 +59,18 @@ module Fingerprinter
59
59
  response = nil
60
60
  3.times do
61
61
  response = Fingerprinter.http_client.get(url, { follow_location: true })[url]
62
- break if response&.code != 0 && !response.return_message.include?('Stream error')
62
+ break if response&.code != 0 || timeout_without_scheme?(url, response)
63
63
 
64
64
  sleep(1)
65
65
  end
66
- return if response&.code&.zero?
66
+
67
+ if stream_error?(response)
68
+ return
69
+ elsif timeout_without_scheme?(url, response)
70
+ url = "https://#{url}"
71
+ return get_response(url)
72
+ end
73
+ return if response&.code == 0
67
74
  return response if same_scope?(url, response)
68
75
 
69
76
  response.redirections.first
@@ -74,5 +81,13 @@ module Fingerprinter
74
81
 
75
82
  Utilities::Urls.uri_parse(url)&.host == Utilities::Urls.uri_parse(response&.effective_url)&.host
76
83
  end
84
+
85
+ def stream_error?(response)
86
+ response&.code&.zero? && response.return_message.include?('Stream error')
87
+ end
88
+
89
+ def timeout_without_scheme?(url, response)
90
+ response&.code == 0 && !url.start_with?('http') && response.return_message.include?('Timeout was reached')
91
+ end
77
92
  end
78
93
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fingerprinter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua MARTINELLE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-10 00:00:00.000000000 Z
11
+ date: 2024-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby