So I have the address for a couple of sites like so www.google.com
and nothing more, no protocol. Is it possible to know which protocol does the website use using any networking tools such as curl
or wget
or anything. I just need to know whether it uses http
or https
2 Answers
You can achieve this with the following command:
openssl s_client -showcerts -connect google.com:443
This assumes that the server you are testing is setup to use the standard https port 443
.
www.google.com works both with http and https.
You can find out if site works with https by using rules from popular extension "HTTPS everywhere" https://www.eff.org/https-everywhere/atlas/ (github source: https://github.com/EFForg/https-everywhere/tree/master/src/chrome/content/rules). Using openssl s_client (see answer Tokozo Zane) can help too. Or you can send HEAD request and look at the location header: curl -I -X HEAD http://ya.ru
http
and then viahttps
- e.g. a simple curl GET or OPTIONS should do it - then check the result - if you don't end up with connection error or timeout it probably means that protocol is used. Note they are not exclusive, depends on how the server is set up. Note also that protocols can be assigned to different ports than standard 80, respectively 443