From a8e4da80583e01e226f94a3f5d1ccffc1cc080c5 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 24 Jan 2014 21:54:00 +0900 Subject: [PATCH] deflatehd: Fix wire is not written if length is 0 --- src/deflatehd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/deflatehd.c b/src/deflatehd.c index 4ecb96fa..09181e1a 100644 --- a/src/deflatehd.c +++ b/src/deflatehd.c @@ -90,7 +90,11 @@ static void output_to_json(nghttp2_hd_context *deflater, json_object_set_new(obj, "percentage_of_original_size", json_real((double)len / inputlen * 100)); to_hex(hex, buf, len); - json_object_set_new(obj, "wire", json_pack("s#", hex, len * 2)); + if(len == 0) { + json_object_set_new(obj, "wire", json_string("")); + } else { + json_object_set_new(obj, "wire", json_pack("s#", hex, len * 2)); + } json_object_set_new(obj, "headers", dump_headers(nva, nvlen)); json_object_set_new(obj, "header_table_size", json_integer(config.table_size));