Skip to content

Commit

Permalink
Issue 152: Fix error message from mget
Browse files Browse the repository at this point in the history
  • Loading branch information
trondn committed Sep 14, 2010
1 parent b942304 commit 8ef1f78
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,12 @@ static void out_string(conn *c, const char *str) {
if (settings.verbose > 1)
fprintf(stderr, ">%d %s\n", c->sfd, str);

/* Nuke a partial output... */
c->msgcurr = 0;
c->msgused = 0;
c->iovused = 0;
add_msghdr(c);

len = strlen(str);
if ((len + 2) > c->wsize) {
/* ought to be always enough. just fail for simplicity */
Expand Down
17 changes: 17 additions & 0 deletions t/issue_152.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/perl

use strict;
use Test::More tests => 2;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;

my $server = new_memcached();
my $sock = $server->sock;
my $key = "a"x251;

print $sock "set a 1 0 1\r\na\r\n";
is (scalar <$sock>, "STORED\r\n", "Stored key");

print $sock "get a $key\r\n";
is (scalar <$sock>, "CLIENT_ERROR bad command line format\r\n", "illegal key");

0 comments on commit 8ef1f78

Please sign in to comment.