4 ms·
Encoding complex objects is just hard (in the sense that it's going to get ugly, complicated, and usually both); however, just getting framing right (i.e. ensur
by JoachimSchipper 11y ago
Encoding complex objects is just hard (in the sense that it's going to get ugly, complicated, and usually both); however, just getting framing right (i.e. ensuring that client and server agree on where messages/objects start and end) at least solves many security problems. A simple binary (tag-)length-value works, as do schemes based on http://cr.yp.to/proto/netstrings.txt http://cr.yp.to/proto/netstrings.txt.
- mst 11y agonetstrings of JSON is my goto for "trivial protocol that people can easily implement".
- JoachimSchipper 11y agoThat's fairly easy when most of your data isn't binary, and when you're using only languages with good UTF-8 support, yes.
- tedunangst 11y agoUsing new line delimiters makes the strings a little prettier, and every IO library has a function to read a line, sparing you the trouble of looking for the colon yourself.