Index: wsgiproxy/exactproxy.py
===================================================================
--- wsgiproxy/exactproxy.py	(revision 7825)
+++ wsgiproxy/exactproxy.py	(working copy)
@@ -9,6 +9,8 @@
     'transfer-encoding',
 )
 
+BLOCK_SIZE = 4096 * 16
+
 def filter_paste_httpserver_proxy(app):
     """
     Maps the ``paste.httpserver`` proxy environment keys to
@@ -95,14 +97,42 @@
     status = '%s %s' % (res.status, res.reason)
     start_response(status, headers_out)
     length = res.getheader('content-length')
-    # @@: This shouldn't really read in all the content at once
     if length is not None:
-        body = res.read(int(length))
+        length = int(length)
+        if length > BLOCK_SIZE:
+            return iter(_BodyIter(conn, res, length))
+        body = res.read(length)
     else:
         body = res.read()
     conn.close()
     return [body]
 
+class _BodyIter(object):
+    """
+    Allow to iter over large response body and close the connection when all
+    data is received.
+    """
+
+    def __init__(self, conn, res, length):
+        self.conn = conn
+        self.res = res
+        self.length = length
+
+    def __iter__(self):
+        return self
+
+    def next(self):
+        if self.length > 0:
+            if self.length > BLOCK_SIZE:
+                data = self.res.read(BLOCK_SIZE)
+                self.length -= BLOCK_SIZE
+            else:
+                data = self.res.read(self.length)
+                self.length = 0
+            return data
+        self.conn.close()
+        raise StopIteration()
+
 def parse_headers(message):
     """
     Turn a Message object into a list of WSGI-style headers.

