Package: re-implement the .netrc auth logic

Support for the .netrc auth was removed in 6a04a0c9623a325a9d81450daf06e44044ce4f65.

Now the auth encoding logic is normalized into an external function,
which both the .getFile() and .getJSON() functions use.

As an added bonus, manually passed in auth credentials now work with .getJSON().
Previously only the .netrc file would be accounted for.