Ensure Content-Length does not appear with Transfer-Encoding

In the HTTPTransport test, verify the requirement of RFC 7230 §3.3.2
that Content-Length not appear if Transfer-Encoding is present.

TEST=crashpad_util_test HTTPTransport.*
BUG=crashpad:159

Change-Id: I51eafff9659443e1d9bb67d1213c8cecc757ded6
Reviewed-on: https://chromium-review.googlesource.com/439984
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
Mark Mentovai 2017-02-08 22:03:54 -05:00
parent cd28471383
commit 1f82c6cc8a

View File

@ -81,6 +81,8 @@ 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))