Merge pull request #967 from dufferzafar/766

Fix minor issues with har_extractor
This commit is contained in:
Aldo Cortesi 2016-02-22 10:09:28 +13:00
commit dca9139fb2

View File

@ -127,11 +127,11 @@ def response(context, flow):
tz=utc).isoformat() tz=utc).isoformat()
request_query_string = [{"name": k, "value": v} request_query_string = [{"name": k, "value": v}
for k, v in flow.request.get_query()] for k, v in flow.request.query]
request_http_version = flow.request.http_version request_http_version = flow.request.http_version
# Cookies are shaped as tuples by MITMProxy. # Cookies are shaped as tuples by MITMProxy.
request_cookies = [{"name": k.strip(), "value": v[0]} request_cookies = [{"name": k.strip(), "value": v[0]}
for k, v in (flow.request.get_cookies() or {}).iteritems()] for k, v in flow.request.cookies.items()]
request_headers = [{"name": k, "value": v} for k, v in flow.request.headers] request_headers = [{"name": k, "value": v} for k, v in flow.request.headers]
request_headers_size = len(str(flow.request.headers)) request_headers_size = len(str(flow.request.headers))
request_body_size = len(flow.request.content) request_body_size = len(flow.request.content)
@ -139,7 +139,7 @@ def response(context, flow):
response_http_version = flow.response.http_version response_http_version = flow.response.http_version
# Cookies are shaped as tuples by MITMProxy. # Cookies are shaped as tuples by MITMProxy.
response_cookies = [{"name": k.strip(), "value": v[0]} response_cookies = [{"name": k.strip(), "value": v[0]}
for k, v in (flow.response.get_cookies() or {}).iteritems()] for k, v in flow.response.cookies.items()]
response_headers = [{"name": k, "value": v} response_headers = [{"name": k, "value": v}
for k, v in flow.response.headers] for k, v in flow.response.headers]
response_headers_size = len(str(flow.response.headers)) response_headers_size = len(str(flow.response.headers))