Index: third_party/crashpad/crashpad/util/net/http_transport_test_server.py |
diff --git a/third_party/crashpad/crashpad/util/net/http_transport_test_server.py b/third_party/crashpad/crashpad/util/net/http_transport_test_server.py |
index 3d3c55a43da3bc415e6bc99c4d0f29085308bb91..7ea15719e8fa8d37e450890e1da811fa91b3671f 100755 |
--- a/third_party/crashpad/crashpad/util/net/http_transport_test_server.py |
+++ b/third_party/crashpad/crashpad/util/net/http_transport_test_server.py |
@@ -33,6 +33,7 @@ This could easily have been written in C++ instead. |
import BaseHTTPServer |
import struct |
import sys |
+import zlib |
class BufferedReadFile(object): |
"""A File-like object that stores all read contents into a buffer.""" |
@@ -81,11 +82,20 @@ class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): |
self.rfile.buffer = '' |
if self.headers.get('Transfer-Encoding', '').lower() == 'chunked': |
+ if 'Content-Length' in self.headers: |
+ raise AssertionError |
body = self.handle_chunked_encoding() |
else: |
length = int(self.headers.get('Content-Length', -1)) |
body = self.rfile.read(length) |
+ if self.headers.get('Content-Encoding', '').lower() == 'gzip': |
+ # 15 is the value of |wbits|, which should be at the maximum possible |
+ # value to ensure that any gzip stream can be decoded. The offset of 16 |
+ # specifies that the stream to decompress will be formatted with a gzip |
+ # wrapper. |
+ body = zlib.decompress(body, 16 + 15) |
+ |
RequestHandler.raw_request += body |
self.send_response(self.response_code) |