在命令行上进行 HTTP 测试,还有比 cURL 更好的吗?
是否有一个命令行实用程序,您可以在其中简单地设置 HTTP 请求并将跟踪简单地输出回控制台?
另外,简单地指定方法将是一个很好的功能,而不是方法的副作用。
我可以使用 cURL 获取所需的所有信息,但我无法找到一种方法来显示它而不将所有内容转储到文件中。
我希望输出显示发送的标头、接收的标头和消息正文。
一定有什么东西在那里,但我无法用谷歌搜索它。我想我应该在自己动手写之前先问一下。
Is there a command line utility where you can simply set up an HTTP request and have the trace simply output back to the console?
Also specifying the method simply would be a great feature instead of the method being a side effect.
I can get all the information I need with cURL but I can't figure out a way to just display it without dumping everything to files.
I'd like the output to show the sent headers the received headers and the body of the message.
There must be something out there but I haven't been able to google for it. Figured I should ask before going off and writing it myself.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我不喜欢回答我自己的问题,但 c-smile 的回答让我走上了正确的道路:
Short Answer shell script over cURL:
The - [dash]meaning stdout is a convention I was notwareed but also work for wget and a number of other unix公用事业。它显然不是 shell 的一部分,而是内置于每个实用程序中。 wget 等效项是:
I dislike answering my own question but c-smile's answer lead me down the right track:
Short answer shell script over cURL:
The - [dash] meaning stdout is a convention I was unaware of but also works for wget and a number of other unix utilities. It is apparently not part of the shell but built into each utility. The wget equivalent is:
您是否尝试过 wget:
http://www.gnu.org/software/wget/manual /wget.html#Wgetrc-命令 ?
就像
wget --save-headers
...Did you try
wget
:http://www.gnu.org/software/wget/manual/wget.html#Wgetrc-Commands ?
Like
wget --save-headers
...要在输出(以及服务器响应)中包含 HTTP 标头,只需使用
curl
的-i
/--include
选项。例如:man curl
对此设置的描述如下:To include the HTTP headers in the output (as well as the server response), just use
curl
’s-i
/--include
option. For example:Here’s what
man curl
says about this setting:尝试 http,例如
http -v example.org
进一步访问 https://httpie.org
它甚至包括一个在线尝试的页面:
https://httpie.org/run
Try http, e.g.
http -v example.org
Further into at https://httpie.org
It even includes a page to try online:
https://httpie.org/run
Telnet 长期以来一直是一种众所周知的(虽然我猜现在已经被遗忘了)查看网页的工具。总体思路是远程登录到 http 端口,键入 http 1.1 GET 命令,然后在屏幕上查看所提供的页面。
一个很好的详细解释是 http://support.microsoft.com/kb/279466
一个<一href="http://www.google.com/search?hl=&q=netgear+fvs318g+user+manual&sourceid=navclient-ff&rlz= 1B3GGHP_enUS431&ie=UTF-8#hl=en&sugexp=ldymls&pq=telnet%20to%20web%20page%20get&xhr=t&q=t elnet+web+page+get&cp=7&pf=p&sclient=psy&rlz=1B3GGHP_enUS431&source=hp&aq=0j&aqi =&aql=&oq=telnet+web+page+get&pbx=1&bav=on.2,or.r_gc.r_pw.&fp=c47720ba43ce4197&bs=1" rel="nofollow"> Google 搜索 会产生更多结果。
Telnet has for long been a well-known (though now forgotten, I guess) tool for looking at a web page. The general idea is to telnet to the http port, to type an http 1.1 GET command, and then to see the served page on the screen.
A good detailed explanation is http://support.microsoft.com/kb/279466
A Google search yields a whole bunch more.
在端口 80 上使用 telnet
例如:
表示 EnterUse telnet on port 80
For example:
<CR>
means Enter