t/httpd-corner.t | 15 +++++++++++++++ diff --git a/t/httpd-corner.t b/t/httpd-corner.t index 56e5a5bcda78744d6fea02e5664743da3b3ff92b..c1dc77dba9a3a5b89fa8420e9c66af962fa19e82 100644 --- a/t/httpd-corner.t +++ b/t/httpd-corner.t @@ -123,6 +123,21 @@ my ($head, $body) = split(/\r\n\r\n/, $buf); like($head, qr/\b413\b/, 'got 413 response'); } +{ + my $conn = conn_for($sock, 'chunk with pipeline'); + my $n = 10; + my $payload = 'b'x$n; + $conn->write("PUT /sha1 HTTP/1.1\r\nTransfer-Encoding: chunked\r\n"); + $conn->write("\r\n".sprintf("%x\r\n", $n)); + $conn->write($payload . "\r\n0\r\n\r\nGET /empty HTTP/1.0\r\n\r\n"); + $conn->read(my $buf, 4096); + my $lim = 0; + $lim++ while ($conn->read($buf, 4096, bytes::length($buf)) && $lim < 9); + my $exp = sha1_hex($payload); + like($buf, qr!\r\n\r\n${exp}HTTP/1\.0 200 OK\r\n!s, + 'chunk parser can handled pipelined requests'); +} + # Unix domain sockets { my $u = IO::Socket::UNIX->new(Type => SOCK_STREAM, Peer => $upath);