Permalink
Browse files

better space fix, and regression

  • Loading branch information...
1 parent 479b5ce commit 5c71b6b14ee93f8ecfcbcca147222fe91d84ce8b @erikfrey erikfrey committed Sep 10, 2012
Showing with 9 additions and 1 deletion.
  1. +1 −1 src/net/request.cpp
  2. +8 −0 tests/request.cpp
View
@@ -50,7 +50,7 @@ request_grammar::request_grammar()
>> ' '
>> key_name [phoenix::ref(req.queue) = qi::_1]
>> *get_option
- >> *lit(' '); // be permissive to clients inserting spaces
+ >> -lit(' '); // be permissive to clients inserting spaces
start = (stats | version | flush | flush_all | set | get) >> qi::eol;
}
View
@@ -67,4 +67,12 @@ BOOST_FIXTURE_TEST_CASE( test_reparse, fixtures::basic_request )
BOOST_REQUIRE_EQUAL(request_.wait_ms, 0);
}
+// test that we can parse a space after the key, which some clients send
+BOOST_FIXTURE_TEST_CASE( test_key_space, fixtures::basic_request )
+{
+ BOOST_REQUIRE(parser_.parse(request_, string("get foo+meow/t=500 \r\n")));
+ BOOST_REQUIRE_EQUAL(request_.wait_ms, 500);
+ BOOST_REQUIRE_EQUAL(request_.queue, "foo+meow");
+}
+
BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 5c71b6b

Please sign in to comment.