untested: try to ping the server before curl -I to prevent lengthy tcp-timeouts for non-existing servers.