您如何通过管道传递"echo"进入"openssl"? [英] How do you pipe "echo" into "openssl"?
问题描述
我只是想向支持SSL的Web服务器提交"OPTIONS/HTTP/1.0"请求;但是,运行此命令时,我只是在连接结束时获得了"DONE"(完成).
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.
推荐答案
此线程中讨论了该问题(链接的电子邮件只有一个简单的答案,我将在下面重复):http://www.mail-archive.com/openssl-users@openssl.org/msg02937.html
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/openssl-users@openssl.org/msg02937.html
(echo "GET /"; sleep 10) | openssl s_client -connect news.ycombinator.com:443
问题是s_client在stdin关闭后立即关闭.因此您的代码可以正常工作,但是s_client在收到OPTIONS之后并且在收到服务器响应之前退出.
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.
这篇关于您如何通过管道传递"echo"进入"openssl"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!