Package: re-implement the .netrc auth logic

Support for the .netrc auth was removed in 6a04a0c.

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.