[bugzilla-gnome-org-extensions] Adjust headers to reflect proper Transfer-Encoding



commit 423ac271d2fca24b7fcc519750186e284bd939f0
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Sep 14 17:47:13 2009 -0400

    Adjust headers to reflect proper Transfer-Encoding
    
    We don't preserve a chunked transfer-encoding, so strip out
    that header and add Content-Length.

 proxy/splinter_proxy.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/proxy/splinter_proxy.py b/proxy/splinter_proxy.py
index 1bc3d50..c93fe3a 100755
--- a/proxy/splinter_proxy.py
+++ b/proxy/splinter_proxy.py
@@ -98,15 +98,20 @@ class ProxyHandler(SimpleHTTPRequestHandler):
     # normally but from do_redirect() if there was a redirect
     def relay_response(self, response):
         self.send_response(response.status, response.reason)
+        content = response.read()
         for header, value in response.getheaders():
             # BaseHTTPRequestHandler sends the 'Server' and 'Date' headers
             # We are handling the "session" with Bugzilla ourselves, so we
             # don't want the browser getting Bugzilla's cookies
-            if header.lower() in ('date', 'server', 'set-cookie'):
+            #
+            # Remove Transfer-Encoding since we end up converting chunked
+            # Transfer-Encoding to unchunked.
+            if header.lower() in ('date', 'server', 'set-cookie', 'transfer-encoding', 'content-length'):
                 continue
             self.send_header(header, value)
+        self.send_header('content-length', len(content))
         self.end_headers()
-        self.wfile.write(response.read())
+        self.wfile.write(content)
         self.wfile.close()
 
     def do_proxied(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]