http2: fix dissection when using Upgrade

The fix for bug 11331 has as side-effect that the HTTP part of a
conversation is not dissected on the second pass.

Fix it by calling the HTTP2 dissector only when it was detected via
heuristics, and not via Upgrade (since that would be handled by the
http loop).

While at it, remove the use of tvb_new_subset_remaining since the
original tvb is not touched and move the comment about the proxy to the
right place.

Tested with the capture from Alexis (plain HTTP2 via Upgrade), the one
from bug 11331 (plain HTTP2 via heuristics) and a HTTP2 in SSL capture
(via heuristics).

Change-Id: Iead7682aa8d5114e4edcfd54eabcd0d659056cc1
Reviewed-on: https://code.wireshark.org/review/10541
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Peter Wu 2015-09-16 00:29:00 +02:00 committed by Alexis La Goutte
parent c36ed56abe
commit 2c7c705157
1 changed files with 8 additions and 6 deletions

View File

@ -2902,16 +2902,18 @@ dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
int len;
conversation_t *conversation;
conv_data = get_http_conversation_data(pinfo, &conversation);
/* Call HTTP2 dissector directly when detected via heuristics, but not
* when it was upgraded (the conversation started with HTTP). */
if (conversation_get_proto_data(conversation, proto_http2) &&
conv_data->upgrade != UPGRADE_HTTP2) {
return call_dissector_only(http2_handle, tvb, pinfo, tree, NULL);
}
/*
* Check if this is proxied connection and if so, hand of dissection to the
* payload-dissector.
* Response code 200 means "OK" and strncmp() == 0 means the strings match exactly */
conv_data = get_http_conversation_data(pinfo, &conversation);
if (conversation_get_proto_data(conversation, proto_http2)) {
/* HTTP2 heuristic dissector already identified this conversation as being HTTP2 traffic.
Call sub dissector directly. */
return call_dissector_only(http2_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree, NULL);
}
if(pinfo->fd->num >= conv_data->startframe &&
conv_data->response_code == 200 &&
conv_data->request_method &&