#!/bin/sh
#Send http request by telnet.
request="GET / HTTP/1.1"
host_header="Host: www.example.com"
dst=www.example.com
port=80echo "$request"
echo "$host_header"
sleep 3(
echo "$request"
echo "$host_header"
echo ""
sleep 5
) | telnet $dst $port
HTTPリクエストをtelnetで送信します。
"$request"と"$host_header"を2回ずつechoしているのは、リクエストヘッダとレスポンスヘッダの両方を標準出力に出力させるためです。
冒頭の echo 2行を省略すると、レスポンスヘッダのみが出力されます。
以上。