Skip to content

Commit 8ef1f78

Browse files
committed
Issue 152: Fix error message from mget
1 parent b942304 commit 8ef1f78

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

memcached.c

+6
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,12 @@ static void out_string(conn *c, const char *str) {
764764
if (settings.verbose > 1)
765765
fprintf(stderr, ">%d %s\n", c->sfd, str);
766766

767+
/* Nuke a partial output... */
768+
c->msgcurr = 0;
769+
c->msgused = 0;
770+
c->iovused = 0;
771+
add_msghdr(c);
772+
767773
len = strlen(str);
768774
if ((len + 2) > c->wsize) {
769775
/* ought to be always enough. just fail for simplicity */

t/issue_152.t

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/perl
2+
3+
use strict;
4+
use Test::More tests => 2;
5+
use FindBin qw($Bin);
6+
use lib "$Bin/lib";
7+
use MemcachedTest;
8+
9+
my $server = new_memcached();
10+
my $sock = $server->sock;
11+
my $key = "a"x251;
12+
13+
print $sock "set a 1 0 1\r\na\r\n";
14+
is (scalar <$sock>, "STORED\r\n", "Stored key");
15+
16+
print $sock "get a $key\r\n";
17+
is (scalar <$sock>, "CLIENT_ERROR bad command line format\r\n", "illegal key");

0 commit comments

Comments
 (0)