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') { if ($method ne 'GET') {
die "invalid method '$method'"; die "invalid method '$method'";
} }
$request = "$method $document$EOL" $request = "$method $document$EOL";
. "$EOL";
} elsif ($version eq '1.0') { } elsif ($version eq '1.0') {
if ($method ne 'GET') { if ($method ne 'GET') {
die "invalid method '$method'"; die "invalid method '$method'";
} }
$request = "$method $document HTTP/$version$EOL" $request = "$method $document HTTP/$version$EOL"
. $user_agent_header . $user_agent_header;
. "$EOL";
} elsif ($version eq '1.1') { } elsif ($version eq '1.1') {
$request = "$method $document HTTP/$version$EOL" $request = "$method $document HTTP/$version$EOL"
. "Host: $host" . (($port and ($port ne $default_port))?":$port":"") . "$EOL" . "Host: $host" . (($port and ($port ne $default_port))?":$port":"") . "$EOL"
. $user_agent_header . $user_agent_header
. "Connection: close$EOL" . "Connection: close$EOL";
. "$EOL";
} else { } else {
die "invalid version '$version'"; die "invalid version '$version'";
} }
$request .= $EOL;
return $request; return $request;
} }