Telnet GET Request vs HEAD Request: why HEAD failed?

3

I thought head syntax was just like GET syntax but when I tried with telnet

o mirror.bytemark.co.uk 80
GET /ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso

it works as expect whereas

o mirror.bytemark.co.uk 80
HEAD /ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso

failed. So what would be the telnet syntax for HEAD request ?

asksuperuser

Posted 2010-06-22T20:55:44.840

Reputation:

Answers

4

You need to specify the HTTP/1.1 protocol has well as Host header

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

radius

Posted 2010-06-22T20:55:44.840

Reputation: 1 301

Thank you so much couldn't find example anywhere on the whole internet ! – None – 2010-06-22T22:29:32.333

1fyi: If the protocol version is not specified, HTTP 0.9 is assumed (because it did not have the headers or the version tag). – user1686 – 2010-06-23T20:08:50.150

@grawity good remark, another one is that HEAD /ubuntu-releases/lucid/ubuntu-10.04-desktop-i386.iso HTTP/1.0 without the Host header also works – radius – 2010-06-23T23:29:37.813