From 8d65ccfee4cb1da05a7e4bae1150ca7f56ce4fb4 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 21 Dec 2019 21:23:27 -0800 Subject: [PATCH] Show answers a line at a time, after the request frame and time delta. Long responses are *really* hard to read if you make them one single string item. Show it a line at a time, as we do with many other text-oriented protocols. Change-Id: Ie2e81dabeba728ed34772d7015c52b0b047904e8 Reviewed-on: https://code.wireshark.org/review/35544 Petri-Dish: Guy Harris Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris --- epan/dissectors/packet-whois.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/epan/dissectors/packet-whois.c b/epan/dissectors/packet-whois.c index 05bd2b6121..7cfee2024b 100644 --- a/epan/dissectors/packet-whois.c +++ b/epan/dissectors/packet-whois.c @@ -118,7 +118,10 @@ dissect_whois(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item_set_generated(ti); } } else if (tree && whois_trans->rep_frame) { - proto_tree_add_item(whois_tree, hf_whois_answer, tvb, 0, -1, ENC_ASCII|ENC_NA); + /* + * If we know the request frame, show it and the time delta between + * the request and the response. + */ if (whois_trans->req_frame) { nstime_t ns; @@ -132,6 +135,24 @@ dissect_whois(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item_set_generated(ti); } } + + /* + * Show the response as text, a line at a time. + */ + int offset = 0, next_offset; + while (tvb_offset_exists(tvb, offset)) { + /* + * Find the end of the line. + */ + tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE); + + /* + * Put this line. + */ + proto_tree_add_item(whois_tree, hf_whois_answer, tvb, offset, + next_offset - offset, ENC_ASCII|ENC_NA); + offset = next_offset; + } } return tvb_captured_length(tvb);