tests:webclient: reduce duplication.

Michael
This commit is contained in:
Michael Adam 2009-09-17 00:24:21 +02:00
parent b7d9256a7a
commit aae8ae5d8d

View File

@ -62,25 +62,24 @@ sub build_request($$$$$)
if ($method ne 'GET') {
die "invalid method '$method'";
}
$request = "$method $document$EOL"
. "$EOL";
$request = "$method $document$EOL";
} elsif ($version eq '1.0') {
if ($method ne 'GET') {
die "invalid method '$method'";
}
$request = "$method $document HTTP/$version$EOL"
. $user_agent_header
. "$EOL";
. $user_agent_header;
} elsif ($version eq '1.1') {
$request = "$method $document HTTP/$version$EOL"
. "Host: $host" . (($port and ($port ne $default_port))?":$port":"") . "$EOL"
. $user_agent_header
. "Connection: close$EOL"
. "$EOL";
. "Connection: close$EOL";
} else {
die "invalid version '$version'";
}
$request .= $EOL;
return $request;
}