wgit 0.4.0 → 0.4.1

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: 0db518346d1a939c13e689856a4ae9946ead17f188185529bce7fc1f97b84fba
4
- data.tar.gz: aee59fe627767c45736e5ae518fe46c46ca9de13e1cd6bed23c0dc5b313aa1e6
3
+ metadata.gz: 70e6ec83e53550bcfe180b66248747763314c33738ecd0fabddca65dbb3918b0
4
+ data.tar.gz: a1c3d1e8bb6d078731876093cb2beed0ea4da65cb03dff1ead975f714bd3d9b5
5
5
  SHA512:
6
- metadata.gz: 5c29a7dc084742132241ec17118eb8dccf39ae57c57aa3364a01c948c4ed1a3304dd1510324b2f3b5d7c9d06ea04802524f6cd9eae00e2f68127e456b8cd9d17
7
- data.tar.gz: 80cae11e47d806bcb14cc77e2628d533e9b466d7fc43d7e6e4fd79b3a65c51df5cbcd6886b62eab88ceb6176d8fdaaf91e45bddd5de3dabae00b245d2cb53968
6
+ metadata.gz: ab519107506ec0798995cb52f986040da12d1a5c59c0c36f84bf8e09d847fd5ab83b3bd7f47ff95b6e474a35d855b176fdc9d245b1cef356781eadb21a4a84f7
7
+ data.tar.gz: '010748005ded444f44812c8b6022d258b60a3485dcef8b78c562012428e3955a7fbfe80f53a570cb9f6b524042388949cf2cf08d6a1b27581f2cfd9b424603b0'
data/lib/wgit/crawler.rb CHANGED
@@ -221,9 +221,10 @@ module Wgit
221
221
  yield(url, response, location) if block_given?
222
222
 
223
223
  # Handle redirect logic.
224
- raise "External redirect not allowed - Redirected to: \
225
- '#{location}', which is outside of host: '#{host}'" \
226
224
  if !follow_external_redirects && !location.relative?(host: host)
225
+ raise "External redirect not allowed - Redirected to: \
226
+ '#{location}', which is outside of host: '#{host}'"
227
+ end
227
228
 
228
229
  raise "Too many redirects, exceeded: #{redirect_count}" \
229
230
  if redirect_count >= @redirect_limit
@@ -250,14 +251,20 @@ module Wgit
250
251
  url = url.normalize if url.respond_to?(:normalize)
251
252
 
252
253
  opts = {
253
- followlocation: false, timeout: @time_out, accept_encoding: 'gzip'
254
+ followlocation: false,
255
+ timeout: @time_out,
256
+ accept_encoding: 'gzip',
257
+ headers: {
258
+ 'User-Agent' => "wgit/#{Wgit::VERSION}",
259
+ 'Accept' => 'text/html'
260
+ }
254
261
  }
255
262
 
256
263
  response = Typhoeus.get(url, opts)
257
264
 
258
265
  # Handle response status code.
259
266
  raise "No response (within timeout: #{@time_out} second(s))" \
260
- if response.code == 0
267
+ if response.code.zero?
261
268
 
262
269
  response
263
270
  end
data/lib/wgit/version.rb CHANGED
@@ -5,5 +5,5 @@
5
5
  # @author Michael Telford
6
6
  module Wgit
7
7
  # The current gem version of Wgit.
8
- VERSION = '0.4.0'
8
+ VERSION = '0.4.1'
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wgit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Telford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-18 00:00:00.000000000 Z
11
+ date: 2019-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable