fetchKSSL: Fix for "status was 'SSL connect error'" #267
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks to Ben Marshall @Kramdog for bringing this up / reminding me that the SSL verification was still an issue in some cases. Since jsonlite changed behind the scenes, we need to attend to fetchKSSL-related downloads.
This updates
fetchKSSL()
to use {curl} internally for downloading the gzipped JSON from SoilWeb. This was what was done implicitly w/fromJSON()
w/ jsonlite <1.8.1, but with thessl_verifyhost
option set in the header.While the base R approach / default headers included in jsonlite >1.8.1 work fine on non-gov machines we occasionally encounter errors related to SSL verification when in the office or connected to VPN, i.e.
Since we recently set up {curl}-based approach for replacing
download.file()
(due to timeout and SSL limitations), we just need to use the standard soilDB curl handle (including ssl_verifyhost=0) to sort this out. The gzipped json is downloaded to a temporary file with curl, then read as agzfile()
connection intojsonlite::fromJSON()
, and then the temp file is unlinked