summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDustin Sallings <dustin@spy.net>2009-05-12 22:51:00 -0700
committerTrond Norbye <Trond.Norbye@sun.com>2009-05-14 00:41:48 +0200
commit0a1e88dafc02db59d64366b85441d73a7ddb87a9 (patch)
tree2bafeb7de6b673fcca9ea2a9c62e77f02950fba7 /t
parenta155b04415a97b87a2fa66250f8ad1bb2c75ce5b (diff)
downloadmemcached-0a1e88dafc02db59d64366b85441d73a7ddb87a9.tar.gz
When receiving bad magic in the binary protocol, hang up.
try_read_command's return value of 0 indicates to the caller that more data is needed, thus it changes the connection state to conn_waiting which blows away the closing state and the connection stays open forever accumulating bad input.
Diffstat (limited to 't')
-rw-r--r--t/issue_50.t16
1 files changed, 16 insertions, 0 deletions
diff --git a/t/issue_50.t b/t/issue_50.t
new file mode 100644
index 0000000..80876b2
--- /dev/null
+++ b/t/issue_50.t
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+
+use strict;
+use Test::More tests => 1;
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+use MemcachedTest;
+
+my $server = new_memcached('-B binary');
+my $sock = $server->sock;
+
+$SIG{ALRM} = sub { die "alarm\n" };
+alarm(2);
+print $sock "Here's a bunch of garbage that doesn't look like the bin prot.";
+my $rv = <$sock>;
+ok(1, "Either the above worked and quit, or hung forever.");