--- a/Pylons-0.9.7/pylons/middleware.py	2009-02-18 01:12:45.000000000 +0100
+++ b/Pylons-0.9.7/pylons/middleware.py	2010-09-09 12:24:39.000000000 +0200
@@ -212,6 +212,13 @@
             
             newstatus, headers, app_iter, exc_info = call_wsgi_application(
                     self.app, new_environ, catch_exc_info=True)
+            # WebOb 0.9.8+ rejects responses where the value of Content-Length
+            # doesn't match the actual length of the content. Since the headers
+            # are modified by the 2nd call to call_wsgi_application() but the
+            # content is still that of the 1st call, we let WebOb determine the
+            # correct length.
+            headers = [(hn, hv) for (hn, hv) in headers
+                        if hn.lower() != 'content-length']
         start_response(status, headers, exc_info)
         return app_iter
 

