Fix #1792 by retrying 502, 504 HTTP errors.
Merge pull request #1798 from danielgtaylor/retry

Fixes #1798, #1792 by retrying 502, 504 HTTP errors.