Make the server decode a pack as it streams.
authorDave Borowitz <dborowitz@google.com>
Thu, 11 Mar 2010 22:12:18 +0000 (14:12 -0800)
committerDave Borowitz <dborowitz@google.com>
Fri, 16 Apr 2010 19:04:12 +0000 (12:04 -0700)
commita22eb8f17ac34d59bd05a947792098119e654787
treebfd561f6353740f0f94e28eecb9c2a640d845586
parentd38fa7e8b5141ddaaacd2eba16ea268f45dacf30
Make the server decode a pack as it streams.

This, in combination with using recv() instead of read(), makes it so we
never do blocking reads past the end of the pack stream, even when the
client doesn't close the connection.

This is done via a PackStreamVerifier class that reads from a Protocol,
unpacks and counts objects, writes through to a file, and computes the
SHA-1 checksum on the fly. It is necessary because the only way we know
when the pack is supposed to end is by parsing the header and reading
the correct number of objects; otherwise, any further reads from the
client would hang.

Changed the Handler constructors to take a Protocol instead of taking
read and write callbacks separately. Modified some interfaces to utility
functions in pack.py so they can be used by the server-side code.

Change-Id: Id4d11e34658d1f00ad06e45330d0d128b367d8e5
dulwich/pack.py
dulwich/server.py
dulwich/tests/compat/test_server.py
dulwich/tests/test_server.py
dulwich/tests/test_web.py
dulwich/web.py