forked from osmocom/wireshark
HTTP2: fix dissection of traffic over HTTP port
Bug: 11331 Change-Id: Ib85e18ebb3c958d68ee3a4295d35982ffcd375ee Reviewed-on: https://code.wireshark.org/review/9525 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
parent
949ff7a112
commit
d36930e2d4
|
@ -62,6 +62,7 @@ static int http_tap = -1;
|
|||
static int http_eo_tap = -1;
|
||||
|
||||
static int proto_http = -1;
|
||||
static int proto_http2 = -1;
|
||||
static int hf_http_notification = -1;
|
||||
static int hf_http_response = -1;
|
||||
static int hf_http_request = -1;
|
||||
|
@ -614,22 +615,21 @@ dissect_http_kerberos(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
|
||||
|
||||
static http_conv_t *
|
||||
get_http_conversation_data(packet_info *pinfo)
|
||||
get_http_conversation_data(packet_info *pinfo, conversation_t **conversation)
|
||||
{
|
||||
conversation_t *conversation;
|
||||
http_conv_t *conv_data;
|
||||
|
||||
conversation = find_or_create_conversation(pinfo);
|
||||
*conversation = find_or_create_conversation(pinfo);
|
||||
|
||||
/* Retrieve information from conversation
|
||||
* or add it if it isn't there yet
|
||||
*/
|
||||
conv_data = (http_conv_t *)conversation_get_proto_data(conversation, proto_http);
|
||||
conv_data = (http_conv_t *)conversation_get_proto_data(*conversation, proto_http);
|
||||
if(!conv_data) {
|
||||
/* Setup the conversation structure itself */
|
||||
conv_data = (http_conv_t *)wmem_alloc0(wmem_file_scope(), sizeof(http_conv_t));
|
||||
|
||||
conversation_add_proto_data(conversation, proto_http,
|
||||
conversation_add_proto_data(*conversation, proto_http,
|
||||
conv_data);
|
||||
}
|
||||
|
||||
|
@ -2901,12 +2901,18 @@ dissect_http(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
|
|||
http_conv_t *conv_data;
|
||||
int offset = 0;
|
||||
int len;
|
||||
conversation_t *conversation;
|
||||
|
||||
/*
|
||||
* 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);
|
||||
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 &&
|
||||
|
@ -2989,9 +2995,10 @@ dissect_http_heur_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
|
|||
static void
|
||||
dissect_http_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||
{
|
||||
conversation_t *conversation;
|
||||
http_conv_t *conv_data;
|
||||
|
||||
conv_data = get_http_conversation_data(pinfo);
|
||||
conv_data = get_http_conversation_data(pinfo, &conversation);
|
||||
dissect_http_message(tvb, 0, pinfo, tree, conv_data);
|
||||
}
|
||||
|
||||
|
@ -3520,6 +3527,7 @@ proto_reg_handoff_message_http(void)
|
|||
|
||||
heur_dissector_add("tcp", dissect_http_heur_tcp, proto_http);
|
||||
|
||||
proto_http2 = proto_get_id_by_filter_name("http2");
|
||||
|
||||
reinit_http();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue