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 <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2019-12-21 21:23:27 -08:00
parent 0442f7a2c3
commit 8d65ccfee4
1 changed files with 22 additions and 1 deletions

View File

@ -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);