Both the first and the second should work. And we can address the first problem by making ChunkedResult take natively an Enumerator. This way we can get the signal that the Enumerator is done, and then we can close the socket or do whatever needed on the end of enumeration.