PageRenderTime 25ms CodeModel.GetById 17ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/t/helper/child-httpd.pl

http://github.com/perlbal/Perlbal
Perl | 18 lines | 11 code | 5 blank | 2 comment | 1 complexity | 28459fb646704d3b8e34e8da5aa47d2e MD5 | raw file
 1#!/usr/bin/perl
 2
 3use strict;
 4my $req = <>;
 5die "Bogus request" unless $req =~ /^GET (\/\S*) HTTP\/1\.\d/;
 6
 7$| = 1;
 8
 9my $uri = $1;
10while (<>) {
11    last unless /\S/;
12}
13
14my $response = "You wanted [$uri] and I am pid=$$\n";
15#warn "Response from pid $$: [$response]\n";
16my $len = length $response;
17print "HTTP/1.0 200 OK\r\nContent-Length: $len\r\n\r\n$response";
18