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 +4 -4
- data/lib/ask/web_fetch/backends/local.rb +7 -1
- data/lib/ask/web_fetch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7dfd9899023ac83785a8751d2256396b0d3493a1b745a895ed96badc0f8efb5d
|
|
4
|
+
data.tar.gz: 5448f692e7a10164b783108ce7c5e99cde376902b379e57890cca908024d59ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|