Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1329)

Unified Diff: third_party/crashpad/crashpad/util/net/http_transport_test_server.py

Issue 2710663006: Update Crashpad to 4a2043ea65e2641ef1a921801c0aaa15ada02fc7 (Closed)
Patch Set: Update Crashpad to 4a2043ea65e2 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698