Just to ensure we hit the code path independently of
WWW code.
} elsif ($path eq '/host-port') {
$code = 200;
push @$body, "$env->{REMOTE_ADDR}:$env->{REMOTE_PORT}";
+ } elsif ($path eq '/callback') {
+ return sub {
+ my ($res) = @_;
+ my $buf = "hello world\n";
+ push @$h, 'Content-Length', length($buf);
+ my $fh = $res->([200, $h]);
+ $fh->write($buf);
+ $fh->close;
+ }
}
[ $code, $h, $body ]
$spawn_httpd->('-W0');
}
+{
+ my $conn = conn_for($sock, 'streaming callback');
+ $conn->write("GET /callback HTTP/1.0\r\n\r\n");
+ ok($conn->read(my $buf, 8192), 'read response');
+ my ($head, $body) = split(/\r\n\r\n/, $buf);
+ is($body, "hello world\n", 'callback body matches expected');
+}
+
+
# Unix domain sockets
{
my $u = IO::Socket::UNIX->new(Type => SOCK_STREAM, Peer => $upath);