S = Server C = Client For binary data, we use the chunked encoding like what's defined in RFC2616. The format is: "$size_of_chunk\r\n$chunk_data". We assume that all data, filenames, signatures and delta are all binary. C: SIG\r\n$filename\r\n$signature "I have $filename with $signature" S: (OK|MISSING|NEWER|DELETE) if OK: File already exists in the same version on the server if MISSING: The server does not have a record of the file (so please upload it) C: PUT $filename\r\n$delta Delta is relative to an empty file. if NEWER: The server has a newer version of the file C: DELTA $filename $signature "Please give me the delta of $filename, from $signature" S: $filename\r\n$delta if DELETE: The server has a record of the file being deleted, and the client should do likewise. XXX: Conflicts. Client-side cache of signatures? Needs "generation" on server too.