elbart/node-memcache — pull request #37 by dylancwood (2014-01-25 00:06:19+00:00)
Title: handle_get() to truncate data on last "\nEND\n"

Searching the buffer string for "END" causes problems if the data inside contains the substring "END". For example, if I retrieve the string "Please do not EXTEND beyond the edge" from my memcached server, the "END" in EXTEND will signal the end of the data, and only "Please do Not E" will be returned. This is fixed by looking for ``crlf + "END" + crlf``. On the off chance that the data contains that string, it is advisable to search for the last occurrence of it, instead of the first.

From what I can tell, there is no way to retrieve multiple values with a single get request, so looking for the last instance of ``crlf + "END" + crlf`` should be fine. However, if I am misinterpreting, and the code needs to be able to handle multiple VALUE...END pieces, let me know and I will change lastIndexOf() to indexOf()