Re: [streams] consider allowing a stream to be removed from a pipeline (#307)

If the cookie decrypter is designed to become `"closed"` when it sees the end of headers, we can use `pipeTo` with the `preventCancel` parameter set to **true** to get notified when the decrypter finishes consuming headers, but without `cancel()`-ing the source. The decrypter needs to have a method to returns unconsumed data written by `pipeTo` so that the user can write the data to the body receiver first before resuming `pipeTo` from the source to the body receiver.

This is handled as non-purposeful closure (https://github.com/whatwg/streams/blob/master/reference-implementation/lib/readable-stream.js#L79), so, we might need to change this line, ... or, making the decrypter `"closed"` may be a wrong approach.

----

Another approach:

The decrypter starts exerting backpressure not to receive data from the network stream anymore. `cookieDecrypter.ready` becomes fulfilled, and then the user cancels the pipeTo. Then, re-pipeTo the body receiver after giving the unused data retrieved from `cookieDecrypter`.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/307#issuecomment-87547145

Received on Monday, 30 March 2015 04:57:11 UTC