Testing Webservers via Telnet or OpenSSL

Today I ran into an issue testing a website where I wanted to telnet to the server to see that it was responding appropriately.  The problem that I ran into was that the site is using SSL encryption.  So using telnet wouldn't cut it.  A quick search let me to Matthew Nuzum's blog, but I wanted to post it on my own blog for future reference.

So if you want to test a regular non-SSL site, you would use the following telnet command (please use your own domain for testing).

telnet google.com 80

After you are connected, you'd paste the following GET request and press enter twice. The empty line signals when your request is complete to the web server. You should then see the page headers and the html content.

GET / HTTP/1.1
Host: google.com

If you wanted to test an SSL enabled site, you would still paste the same GET request to the web server. But instead of using telnet, you would need to use the openssl command below. After you run the command, you'll see details of the web server's certificate. Then paste in the GET request and you should get back the page headers and content. Matthew's blog mentions that it is best to type your GET request into a text document and use copy and paste rather than typing it each time. I guess there can be a relatively short timeout depending on the server configuration.

openssl s_client -connect google.com:443

Tags: ,

Leave a Reply