]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/httpd-corner.t
http: reject excessive headers
[public-inbox.git] / t / httpd-corner.t
index 833eb4294687361c06c38277e6bf3d7c98dc9ae9..8670846cad68eac0deb4e935c9f9ac3ec2d75da7 100644 (file)
@@ -84,6 +84,18 @@ my $spawn_httpd = sub {
        is($body, "hello world\n", 'callback body matches expected');
 }
 
+{
+       my $conn = conn_for($sock, 'excessive header');
+       $SIG{PIPE} = 'IGNORE';
+       $conn->write("GET /callback HTTP/1.0\r\n");
+       foreach my $i (1..500000) {
+               last unless $conn->write("X-xxxxxJunk-$i: omg\r\n");
+       }
+       ok(!$conn->write("\r\n"), 'broken request');
+       ok($conn->read(my $buf, 8192), 'read response');
+       my ($head, $body) = split(/\r\n\r\n/, $buf);
+       like($head, qr/\b400\b/, 'got 400 response');
+}
 
 # Unix domain sockets
 {