URL fetching: use an intermediate function rather than a wrapper
Do not get MIME types base on URLs.
Small refactoring.
URL fetching: enforce closing sockets/files with a context manager.