Re: Revamping the git protocol

From: Linus Torvalds <torvalds@osdl.org>
Date: 2005-10-21 02:20:09
On Wed, 19 Oct 2005, H. Peter Anvin wrote:
> 
> 1. "Strings" are sequences of bytes prefixed with a length.  The length is
> encoded as four lower-case hexadecimal digits.  [Why not as 2 or 4 bytes of
> network byte order binary?]  When represented in this text as "foo", this
> means the sequence of bytes on the wire is <0003foo>.

As a reason for your "why" - imagine debugging a protocol using telnet..

ASCII really is very nice for things like that.

And no, "foo" is not represented as <0003foo>. It's represented as 
<0007foo>, because the length includes the length of the prefix.

The special sequence <0000> is a flush sequence, and it's designed so that 
it's supposed to be distinguishable from an empty string <0004>. A <0001> 
to <0003> will be rejected as an error. Maximum string length is thus 
65531.

(Actually, right now flush it is _not_ distinguishable from an empty 
string because we return 0 for both cases from packet_read_line(), but the 
point being that the packet protocol _supports_ it being distinguishable 
if we ever need it to).

			Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Oct 21 02:20:49 2005

This archive was generated by hypermail 2.1.8 : 2005-10-21 02:20:52 EST