Binary protocol "total body length"

Todd Lipcon todd at
Thu Apr 3 07:22:13 UTC 2008

Hey all,

I'm working on an erlang binary protocol client and came across an 
inconsistency between the docs and the implementation. On 
binary-protocol-plan-v2.txt:214 it describes "Total body length" as 
"Length in bytes of extra + key + value". This seems to work correctly for 
the requests I'm making. However, in reading responses back from the 
server it seems to be incorrect.

I'm issuing a simple set and getting a response with "Extras length" of 16 
and "Total body length" of 0:

Read binary protocol data:  80010005 0c000000 00000016 00000000
Command: 1, opaque=00000000, keylen=5, total_len=22
Value len is 1
Writing bin response:  81010000 10000000 00000000 00000000

Clearly if "total body length" is supposed to be equal to extras_length + 
key_length + value_length, then this shouldn't be possible.

Is this an implementation bug or should the doc be fixed to match?


More information about the memcached mailing list