Incremental construction of Reponse


I want to intercept some requests and replace the response with my own response. Sadly, generating this response takes some time (it doesn’t happen by a simple process like substituting words) but I can do it incrementally: A few kilobytes here, a few a second later etc. If I had a socket or stream to send my chunks to, I would be happy. Otherwise, my client might close the connection before receiving anything — although I could have delivered enough bytes of the response to keep the client happy.

I see there is, but this doesn’t do what I need (since I completely forge the response and the timing of my response is independent of anything I receive from the server); additionally, there seems to be a flow.client_conn. I’m not sure what this does for me as it’s not really documented (other than being a ClientConnection).