¿Hay alguna manera de determinar si una URL usa SSL? Antes de enviar cualquier otra cosa a la URL, quiero saber si solo acepta conexiones HTTP o HTTPS.
Respuestas
2 para la respuesta № 1Puede usar el siguiente script si tiene acceso a wget.
#/bin/bash
URL=google.com
if wget --spider https://$URL 2>/dev/null; then
echo "https is present"
else
echo "https not present"
fi
Tenga en cuenta que necesita tener configurado http_proxy / https_proxy.
Probé el script anterior en cygwin64 [no tengo acceso al sistema nix a partir de ahora]
También debería poder modificar el mismo script utilizando curl.
2 para la respuesta № 2
http
if [[ $(wget -S --spider http://yoursite 2>&1 | grep "HTTP/1.1 200 OK") ]]; then echo "true"; fi
https
if [[ $(wget -S --spider https://yoursite 2>&1 | grep "HTTP/1.1 200 OK") ]]; then echo "true"; fi