From 2ea1deafd00f3d4ff0ddab8f6ca4e81b5cd6b71e Mon Sep 17 00:00:00 2001 From: acesso Date: Sat, 27 Jun 2015 09:47:53 -0300 Subject: [PATCH 1/2] Add comment on HAR on pushed objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that HAR 1.2 does not have a proper representaion for pushed objects. I couldĀ“t just add a custom parameter so I think a comment at response will not hurt anybody. --- src/nghttp.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nghttp.cc b/src/nghttp.cc index 3ca9d4eb..8b31924b 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -1443,6 +1443,10 @@ void HttpClient::output_har(FILE *outfile) { json_object_set_new(response, "headersSize", json_integer(-1)); json_object_set_new(response, "bodySize", json_integer(-1)); + auto pushed = req->stream_id % 2 == 0; + + json_object_set_new(response, "comment", json_string(pushed ? "Pushed Object" : "")); + json_object_set_new(entry, "cache", json_object()); auto timings = json_object(); From 49c3d75f9a7280a8969641b7c00e2fb2eee17f8b Mon Sep 17 00:00:00 2001 From: acesso Date: Mon, 29 Jun 2015 15:31:00 -0300 Subject: [PATCH 2/2] Right place for comment comment of pushed moved from request to entry array added stream_id as string to connection element as string --- src/nghttp.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/nghttp.cc b/src/nghttp.cc index 8b31924b..f837add4 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -1376,6 +1376,10 @@ void HttpClient::output_har(FILE *outfile) { entry, "startedDateTime", json_string(util::format_iso8601(request_time).c_str())); json_object_set_new(entry, "time", json_real(time_sum)); + + auto pushed = req->stream_id % 2 == 0; + + json_object_set_new(entry, "comment", json_string(pushed ? "Pushed Object" : "")); auto request = json_object(); json_object_set_new(entry, "request", request); @@ -1442,11 +1446,6 @@ void HttpClient::output_har(FILE *outfile) { json_object_set_new(response, "redirectURL", json_string("")); json_object_set_new(response, "headersSize", json_integer(-1)); json_object_set_new(response, "bodySize", json_integer(-1)); - - auto pushed = req->stream_id % 2 == 0; - - json_object_set_new(response, "comment", json_string(pushed ? "Pushed Object" : "")); - json_object_set_new(entry, "cache", json_object()); auto timings = json_object(); @@ -1464,6 +1463,7 @@ void HttpClient::output_har(FILE *outfile) { json_object_set_new(timings, "receive", json_real(receive_delta)); json_object_set_new(entry, "pageref", json_string(PAGE_ID)); + json_object_set_new(entry, "connection", json_string(util::utos(req->stream_id).c_str())); } json_dumpf(root, outfile, JSON_PRESERVE_ORDER | JSON_INDENT(2));