diff options
author | Joakim Karlsson <oakimk@gmail.com> | 2018-12-19 13:08:41 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-12-20 05:41:18 +0000 |
commit | 8d23cdd0fad953f8900da64a27eeea09a99fcf6a (patch) | |
tree | 50a0df47e1154ed29be65d4fad8e557af451d2b6 /epan/dissectors | |
parent | f1d8b22fece7cc46821212f52237610c33f91f56 (diff) |
http2: add Header unescaped presentation
This will present the Header in unescaped format, without percent-coding.
ex.
&requester-plmn=%7B%22mcc%22%3A%22240%22%2C%20%22mnc%22%3A%2201%22%7D&
to
&requester-plmn={"mcc":"240", "mnc":"01"}&
Change-Id: I44296bf564a9dd75bf172503a277d48f116d26fd
Reviewed-on: https://code.wireshark.org/review/31119
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-http2.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c index 51636df0ed..9e6b048a61 100644 --- a/epan/dissectors/packet-http2.c +++ b/epan/dissectors/packet-http2.c @@ -275,6 +275,7 @@ static int hf_http2_header_name_length = -1; static int hf_http2_header_name = -1; static int hf_http2_header_value_length = -1; static int hf_http2_header_value = -1; +static int hf_http2_header_unescaped = -1; static int hf_http2_header_repr = -1; static int hf_http2_header_index = -1; static int hf_http2_header_table_size_update = -1; @@ -1603,6 +1604,7 @@ inflate_http2_header_block(tvbuff_t *tvb, packet_info *pinfo, guint offset, const gchar *method_header_value = NULL; const gchar *path_header_value = NULL; http2_header_stream_info_t* header_stream_info; + gchar *header_unescaped = NULL; if (!http2_hdrcache_map) { http2_hdrcache_map = wmem_map_new(wmem_file_scope(), http2_hdrcache_hash, http2_hdrcache_equal); @@ -1819,6 +1821,14 @@ inflate_http2_header_block(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree_add_item_ret_string(header_tree, hf_http2_header_value, header_tvb, hoffset, header_value_length, ENC_ASCII|ENC_NA, wmem_packet_scope(), &header_value); // check if field is http2 header https://tools.ietf.org/html/rfc7541#appendix-A try_add_named_header_field(header_tree, header_tvb, hoffset, header_value_length, header_name, header_value); + + /* Add header unescaped. */ + header_unescaped = g_uri_unescape_string(header_value, NULL); + if (header_unescaped != NULL) { + ti = proto_tree_add_string(header_tree, hf_http2_header_unescaped, header_tvb, hoffset, header_value_length, header_unescaped); + PROTO_ITEM_SET_GENERATED(ti); + g_free(header_unescaped); + } hoffset += header_value_length; /* Only track HEADER and CONTINUATION frames part there of. Don't look at PUSH_PROMISE and trailing CONTINUATION. @@ -3073,6 +3083,11 @@ proto_register_http2(void) FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, + { &hf_http2_header_unescaped, + { "Unescaped", "http2.header.unescaped", + FT_STRING, BASE_NONE, NULL, 0x0, + NULL, HFILL } + }, { &hf_http2_header_repr, { "Representation", "http2.header.repr", FT_STRING, BASE_NONE, NULL, 0x0, |