Accept file and http URI in the `-f` flag.

This patch was slightly modified to make it merge correctly against
master
(original patch by @jsvd is #1873)

Closes #1873