If you don't mind installing a Perl module Net::HTTP, you can do that very easily. The write_request() does not return until a response can be received.
$ time perl -MNet::HTTP -e '$h = Net::HTTP->new(Host => "www.sun.com"); $h->write_request(HEAD => "/")'
real 0m2.746s
user 0m0.072s
sys 0m0.012s
The corresponding packet dump to show a HEAD request was actually sent:
[root@bernardchan ~]# tcpdump -s 0 -A -i eth0 tcp and port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
10:15:30.925197 IP bernardchan.41865 > 72.5.124.61.http: S 2605374828:2605374828(0) win 5840 <mss 1460,sackOK,timestamp 482811 0,nop,wscale 2>
E..<..@.@.*|..
.H.|=...P.J.l........&..........
..].........
10:15:31.120470 IP 72.5.124.61.http > bernardchan.41865: S 3988518783:3988518783(0) ack 2605374829 win 33304 <nop,nop,timestamp 1576677510 482811,mss 1460,nop,wscale 0,nop,nop,sackOK>
E..@.=@.1...H.|=..
..P.......J.m....5......
].0...].............
10:15:31.120547 IP bernardchan.41865 > 72.5.124.61.http: . ack 1 win 1460 <nop,nop,timestamp 482860 1576677510>
E..4..@.@.*...
.H.|=...P.J.m...............
..^,].0.
10:15:31.121101 IP bernardchan.41865 > 72.5.124.61.http: P 1:58(57) ack 1 win 1460 <nop,nop,timestamp 482860 1576677510>
E..m..@.@.*I..
.H.|=...P.J.m...............
..^,].0.HEAD / HTTP/1.1
Connection: close
Host: www.sun.com
10:15:31.121423 IP bernardchan.41865 > 72.5.124.61.http: F 58:58(0) ack 1 win 1460 <nop,nop,timestamp 482860 1576677510>
E..4..@.@.*...
.H.|=...P.J.................
..^,].0.
10:15:31.315358 IP 72.5.124.61.http > bernardchan.41865: . ack 58 win 33304 <nop,nop,timestamp 1576677530 482860>
E..4.>@.1...H.|=..
..P.......J......v,.....
].0...^,
10:15:31.315474 IP 72.5.124.61.http > bernardchan.41865: . ack 59 win 33304 <nop,nop,timestamp 1576677530 482860>
E..4.?@.1...H.|=..
..P.......J......v+.....
].0...^,
10:15:31.345593 IP 72.5.124.61.http > bernardchan.41865: F 517:517(0) ack 59 win 33304 <nop,nop,timestamp 1576677533 482860>
E..4.A@.1...H.|=..
..P.......J......t#.....
].0...^,
10:15:31.345644 IP bernardchan.41865 > 72.5.124.61.http: R 2605374887:2605374887(0) win 0
E..(..@.@.....
.H.|=...P.J......P....l..
10:15:31.348082 IP 72.5.124.61.http > bernardchan.41865: P 1:517(516) ack 59 win 33304 <nop,nop,timestamp 1576677533 482860>
E..8.@@.1...H.|=..
..P.......J.............
].0...^,HTTP/1.1 200 OK
Server: Sun-Java-System-Web-Server/6.1
Date: Thu, 03 Apr 2008 02:15:32 GMT
Content-type: text/html;charset=UTF-8
P3p: policyref="http://www.sun.com/p3p/Sun_P3P_Policy.xml", CP="CAO DSP COR CUR ADMa DEVa TAIa PSAa PSDa CONi TELi OUR SAMi PUBi IND PHY ONL PUR COM NAV INT DEM CNT STA POL PRE GOV"
X-powered-by: Servlet/2.4,JSP/2.0
Connection: close
Set-cookie: Starload=star-fep5; Path=/
Set-cookie: JSESSIONID=12112cc14aabcdfffffffffe2641a9e183505; Path=/
Set-cookie: JROUTE=Pe4Y; Path=/
10:15:31.348114 IP bernardchan.41865 > 72.5.124.61.http: R 2605374887:2605374887(0) win 0
E..(..@.@.....
.H.|=...P.J......P....l..