summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-http.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2015-07-06 23:16:33 +0200
committerPascal Quantin <pascal.quantin@gmail.com>2015-07-09 17:05:28 +0000
commitd36930e2d4a5118023182fd8ac3237e546436c87 (patch)
tree657d79cc720ed3a3a94109df7ee293c5e584e403 /epan/dissectors/packet-http.c
parent949ff7a112d7728afea1039306f17dc78211bf29 (diff)
downloadwireshark-d36930e2d4a5118023182fd8ac3237e546436c87.tar.gz
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>
Diffstat (limited to 'epan/dissectors/packet-http.c')
-rw-r--r--epan/dissectors/packet-http.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c
index 50a2a88a50..78649c2456 100644
--- a/epan/dissectors/packet-http.c
+++ b/epan/dissectors/packet-http.c
@@ -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();
}