84 lines
1.1 KiB
Bash
84 lines
1.1 KiB
Bash
#! /bin/bash
|
|
|
|
test_name="Header Test"
|
|
|
|
config_file="./Tester/test1.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.log
|
|
echo -e "$request"
|
|
sleep 1
|
|
echo -e "\n\n" >> telnet.log
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# expected result...
|
|
|
|
files=()
|
|
|
|
file="expected_header_test.txt"
|
|
files+=("expected_header_test.txt")
|
|
#files+=("expected_path_root_test.txt")
|
|
|
|
|
|
local_expected_test_files=()
|
|
test_path=""
|
|
|
|
add_path()
|
|
{
|
|
for i in "${files[@]}"
|
|
do
|
|
local_expected_test_files+=("$test_path$i")
|
|
done
|
|
}
|
|
|
|
#add_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|