I am simply trying to submit the "OPTIONS / HTTP/1.0" request to SSL-enabled web servers; however, when running this, I am just simply getting "DONE" At the end of the connection.
Here's the exact command that I'm using:
echo -e "OPTIONS / HTTP/1.0\r\n\r\n" | openssl s_client -connect site.com:443
Any suggestions? I'm sure I'm missing something very simple.
There's an -ign_eof
option which does exactly what you want without any hacks. It's been in the codebase since 2000 (0.9.5a), apparently.
The option suppresses the special interpretation of Q and R, and ignores an EOF on stdin. Instead, it waits for a connection close.
the problem is discussed in this thread (the linked email has the only simple answer, which i'll repeat below): http://www.mail-archive.com/[email protected]/msg02937.html
(echo "GET /"; sleep 10) | openssl s_client -connect news.ycombinator.com:443
the problem being that s_client shuts down as soon as stdin closes. so your code works fine, but s_client is exiting after receiving the OPTIONS and before receiving the server response.
Late answer...
seems if you add a 'cat' to your subshell it works.
(echo -ne "GET / HTTP/1.1\r\nHost: google.com\r\n\r\n" ; cat ) | openssl s_client -connect google.com:443
That 'cat' hangs around, and you can actually then continue interacting with s_client manually. I have only done a single test here, but I need this same ability to pipe in http headesr/bodies from command line to an ssl server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With