我以为 head 语法就像 GET 语法,但是当我尝试使用 telnet 时
o mirror.bytemark.co.uk 80
GET /ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso
它按预期工作,而
o mirror.bytemark.co.uk 80
HEAD /ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso
失败了。那么 HEAD 请求的 telnet 语法是什么?
答案1
您需要指定 HTTP/1.1 协议以及 Host 标头
o mirror.bytemark.co.uk 80
HEAD /ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso HTTP/1.1
Host: mirror.bytemark.co.uk
HTTP/1.1 200 OK
Date: Tue, 22 Jun 2010 20:59:19 GMT
Server: Apache/2.2.9 (Debian)
Last-Modified: Thu, 29 Apr 2010 12:56:31 GMT
ETag: "238046-2bb71800-4855fa7d53dc0"
Accept-Ranges: bytes
Content-Length: 733419520
Content-Type: application/x-iso9660-image