Telnet GET请求与HEAD请求:为什么HEAD失败?


3

我认为头语法就像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语法是什么?

Answers:


4

您需要指定HTTP / 1.1协议以及主机头

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

非常感谢你在整个互联网上找不到任何例子!

1
fyi:如果未指定协议版本,则假定为HTTP 0.9(因为它没有头文件或版本标签)。
grawity 2010年

@grawity好评,另一个是HEAD /ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso HTTP / 1.0没有主机头也可以
半径2010年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.