ask-web-fetch 0.7.4 → 0.7.5

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: 412118d0b9d8d15d1677f877dcdd06cc3ca3d64f6afb79be80ae7fb404bdc8c5
4
- data.tar.gz: 18a022bec912f32ecd7f1afca82c11e7e5f016199779b92fec86ec5deb1428a7
3
+ metadata.gz: 7dfd9899023ac83785a8751d2256396b0d3493a1b745a895ed96badc0f8efb5d
4
+ data.tar.gz: 5448f692e7a10164b783108ce7c5e99cde376902b379e57890cca908024d59ce
5
5
  SHA512:
6
- metadata.gz: b12c4fbcc8e2f76d1b76b07836e1c7aeaa735e22c75b085571a1a8f710425637b461a97f2ec5c073d6e88b1d843aeca9da50d2ecba36d72ad21fcd4da7926852
7
- data.tar.gz: 054750f93da3d1af328fb312867d26cbf4f7631133d9e79f76eb759816fd376e30b1a8df1b1b3f52d5752f8eac15aa38143c1c9484222543a20301c947ea2b4d
6
+ metadata.gz: 598e9c3c242acfe3cc405b9ed568dbd997a9e43489248d50651b79f8f2c68e8ebfb55ba3fdf4acaf8b823e2cbcce99958894f43d296cceb8a6ca37bbf5e5943a
7
+ data.tar.gz: f166296ca3c09ccf4870c7a68b16e8a82537adbc065e5190aba980590b9951b532c7570c37617bda868d3ac87d772a8ae0d0bf9c42926922772810a0644701c4
@@ -208,8 +208,14 @@ module Ask
208
208
  end
209
209
 
210
210
  unless (300..399).cover?(response.status) && !response.location.empty?
211
- # 4xx (other than 429) = the URL is dead; 429/5xx = transient.
212
211
  code = response.status
212
+ # 404: return the body so fetch() can try to extract content
213
+ # from custom error pages (some 404 pages carry navigation,
214
+ # search suggestions, or useful content).
215
+ if code == 404
216
+ return [response.body, response.content_type, redirect_info(first_hop_status, uri), code]
217
+ end
218
+ # 429/5xx = transient; other 4xx = the URL is dead.
213
219
  raise(code == 429 || code >= 500 ? ServerError : FetchError, "got #{code} from #{url}")
214
220
  end
215
221
  raise FetchError, "hit a redirect loop at #{url}" if (hops += 1) > MAX_REDIRECTS
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module WebFetch
5
- VERSION = '0.7.4'
5
+ VERSION = '0.7.5'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-web-fetch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto