title: How can I get some chunks come from what flow using mitmproxy?
body: <p>I am building web proxy using the following <code>mitmproxy</code>.
  <a href="https://github.com/mitmproxy/mitmproxy" rel="nofollow noreferrer">https://github.com/mitmproxy/mitmproxy</a></p>
  
  <p>I want to scan streaming body and pass them to client.
  <code>mitmproxy</code> already has the similar feature; <a href="https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/addons/streambodies.py" rel="nofollow noreferrer">https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/addons/streambodies.py</a></p>
  
  <p>I implemented the following code.</p>
  
  <pre class="lang-py prettyprint-override"><code>def responseheaders(self, flow):
      flow.response.stream = self.response_stream
  
  def response_stream(self, chunks):
      for chunk in chunks:
          if not my_function(chunk):
              raise Exception('catch')
           yield chunk
  </code></pre>
  
  <p>In my above code, there is no way to catch some chunks come from whose flow when <code>my_function</code> returns <code>False</code>. </p>
  
  <p>i want to get from what flow some chunks come in flow.response.stream feature.</p>