diff options
author | Michael Adam <obnox@samba.org> | 2009-09-14 10:13:29 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-09-14 11:02:28 +0200 |
commit | afacc3d80b58be77945fbd965b68d407173126a3 (patch) | |
tree | 2d926cc068ea084ef2d96f4a9c283453cdd99397 | |
parent | 8f8f99098e714e7ca18f856f85c6a284306ef8e7 (diff) | |
download | tinyproxy-afacc3d80b58be77945fbd965b68d407173126a3.tar.gz tinyproxy-afacc3d80b58be77945fbd965b68d407173126a3.zip |
tests:webserver: move parsing of request to its own function.
(Prepare for really parsing the request...)
Michael
Diffstat (limited to '')
-rwxr-xr-x | tests/scripts/webserver.pl | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/tests/scripts/webserver.pl b/tests/scripts/webserver.pl index 1dc1646..a006830 100755 --- a/tests/scripts/webserver.pl +++ b/tests/scripts/webserver.pl @@ -75,6 +75,23 @@ sub REAPER { $SIG{CHLD} = \&REAPER; } +sub parse_request($) { + my $client = shift; + + my $request = ""; + while (my $request_line = <$client>) { + $request .= $request_line; + last if ($request_line eq $EOL); + } + + logmsg "request:\n" . + "------------------------------\n" . + "$request" . + "------------------------------"; + + return $request; +} + sub child_action($) { my $client = shift; my $client_ip = shift; @@ -90,16 +107,7 @@ sub child_action($) { $fortune =~ s/\n/$EOL/g; } - my $request = ""; - while (my $request_line = <$client>) { - $request .= $request_line; - last if ($request_line eq $EOL); - } - - logmsg "request:\n" . - "------------------------------\n" . - "$request" . - "------------------------------"; + my $request = parse_request($client); print $client "HTTP/1.0 200 OK$EOL"; print $client "Server: Tinyproxy-Test-Web-Server/$VERSION$EOL"; |