我不确定 netcat 是否有一些用于请求 http 标头的命令,还是应该使用 sed 来过滤结果?如果在这种情况下使用 sed,是不是我只需要在第一个“<”出现之前提取所有内容?
问问题
410 次
1 回答
0
The command line tool curl
has the -I
option which only gets the headers:
-I/--head
(HTTP/FTP/FILE) Fetch the HTTP-header only! HTTP-servers feature the command HEAD which this uses to get nothing but the header of a document. When used on a FTP or FILE file, curl displays the file size and last modification time only.
Demo:
$ curl -I stackoverflow.co.uk
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 503
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Thu, 26 Sep 2013 21:06:15 GMT
于 2013-09-26T21:08:00.263 回答