aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-json.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-08-21 23:33:23 -0700
committerGuy Harris <guy@alum.mit.edu>2016-08-22 06:34:06 +0000
commit5825f59ddccb8af2b4a06356f61195dd26c977d7 (patch)
tree5250e297808ccc0dd7dd36c688dbba8d53368c75 /epan/dissectors/packet-json.c
parentefdcb25360621e5ac14f276b37964f27f4ce0ba4 (diff)
Pass an HTTP message type to all HTTP subdissectors.
This gets complicated, because those subdissectors might be called by other dissectors as well. We need a better way of passing that sort of out-of-bound information. Pull some routines used for processing Content-Type parameters into common code; we can't guarantee that the media parameters passed in would be writable (passing it as *the* data hid that; passing a structure with that *and* the HTTP message type revealed it), so don't convert it to lower-case in place. Use that information, if available, to determine whether an IPP message is a requet or a response. Change-Id: I4bccc9f05cd0b14ad445be7ab37b3d884d841325 Reviewed-on: https://code.wireshark.org/review/17216 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-json.c')
-rw-r--r--epan/dissectors/packet-json.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/epan/dissectors/packet-json.c b/epan/dissectors/packet-json.c
index 044403b7b9..1fa50ea182 100644
--- a/epan/dissectors/packet-json.c
+++ b/epan/dissectors/packet-json.c
@@ -38,6 +38,8 @@
#include <wiretap/wtap.h>
+#include "packet-http.h"
+
void proto_register_json(void);
void proto_reg_handoff_json(void);
static char *json_string_unescape(tvbparse_elem_t *tok);
@@ -116,6 +118,7 @@ dissect_json(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
json_parser_data_t parser_data;
tvbparse_t *tt;
+ http_message_info_t *message_info;
const char *data_name;
int offset;
@@ -138,12 +141,20 @@ dissect_json(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
/*
* No information from "match_string"
*/
- data_name = (char *)data;
- if (! (data_name && data_name[0])) {
+ message_info = (http_message_info_t *)data;
+ if (message_info == NULL) {
/*
* No information from dissector data
*/
data_name = NULL;
+ } else {
+ data_name = message_info->media_str;
+ if (! (data_name && data_name[0])) {
+ /*
+ * No information from dissector data
+ */
+ data_name = NULL;
+ }
}
}