56 lines
803 B
Bash
56 lines
803 B
Bash
#! /bin/bash
|
|
|
|
test_name="Header Test"
|
|
|
|
config_file="default.config"
|
|
port=4040
|
|
host="localhost"
|
|
|
|
paths=("/") # you can add many
|
|
#methods=("GET" "POST" "DELETE")
|
|
methods=("GET")
|
|
httpz=("HTTP/1.1")
|
|
|
|
|
|
|
|
|
|
# the parts we will send to webserv
|
|
|
|
|
|
# let main.sh handle the l1
|
|
|
|
l1="${methods[0]} ${paths[0]} ${httpz[0]}"
|
|
|
|
header="Host: $host\n"
|
|
header+="Nonsense: fu\n"
|
|
|
|
header_cycle=("Transfer-encoding: fu" "Content-encoding: fu")
|
|
|
|
#header+="Transfer-encoding: fu\n"
|
|
#header+="Content-endcoding: fu\n"
|
|
body=
|
|
|
|
|
|
run_this_test()
|
|
{
|
|
|
|
for i in "${header_cycle[@]}"
|
|
do
|
|
header_send="$header$i"
|
|
request="$l1\n$header_send\n$body\n"
|
|
{
|
|
echo "----- $test_name -----"
|
|
echo -e "$_RED$request$_END"
|
|
} >> telnet.out
|
|
echo -e "$request"
|
|
sleep 1
|
|
echo -e "\n\n" >> telnet.out
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# expected result...
|
|
|