- From: Takeshi Yoshino <notifications@github.com>
- Date: Sun, 29 Mar 2015 21:56:49 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Message-ID: <whatwg/streams/issues/307/87547145@github.com>
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