summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-spdy.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-spdy.c
parentefdcb25360621e5ac14f276b37964f27f4ce0ba4 (diff)
downloadwireshark-5825f59ddccb8af2b4a06356f61195dd26c977d7.tar.gz
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-spdy.c')
-rw-r--r--epan/dissectors/packet-spdy.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/epan/dissectors/packet-spdy.c b/epan/dissectors/packet-spdy.c
index 19640100ba..30835896c8 100644
--- a/epan/dissectors/packet-spdy.c
+++ b/epan/dissectors/packet-spdy.c
@@ -40,6 +40,7 @@
#include <epan/tap.h>
#include "packet-tcp.h"
#include "packet-ssl.h"
+#include "packet-http.h"
#ifdef HAVE_ZLIB
#define ZLIB_CONST
@@ -177,6 +178,7 @@ typedef struct _spdy_data_frame_t {
} spdy_data_frame_t;
typedef struct _spdy_stream_info_t {
+ http_type_t message_type;
gchar *content_type;
gchar *content_type_parameters;
gchar *content_encoding;
@@ -514,6 +516,7 @@ static spdy_conv_t * get_or_create_spdy_conversation_data(packet_info *pinfo) {
*/
static void spdy_save_stream_info(spdy_conv_t *conv_data,
guint32 stream_id,
+ http_type_t message_type,
gchar *content_type,
gchar *content_type_params,
gchar *content_encoding) {
@@ -524,6 +527,7 @@ static void spdy_save_stream_info(spdy_conv_t *conv_data,
}
si = (spdy_stream_info_t *)wmem_alloc(wmem_file_scope(), sizeof(spdy_stream_info_t));
+ si->message_type = message_type;
si->content_type = content_type;
si->content_type_parameters = content_type_params;
si->content_encoding = content_encoding;
@@ -725,6 +729,7 @@ static int dissect_spdy_data_payload(tvbuff_t *tvb,
dissector_handle_t handle;
guint num_data_frames;
gboolean dissected;
+ http_message_info_t message_info;
/* Add frame description. */
proto_item_append_text(spdy_proto, ", Stream: %d, Length: %d",
@@ -911,11 +916,13 @@ static int dissect_spdy_data_payload(tvbuff_t *tvb,
handle = dissector_get_string_handle(media_type_subdissector_table,
si->content_type);
}
+ message_info.type = si->message_type;
+ message_info.media_str = media_str;
if (handle != NULL) {
/*
* We have a subdissector - call it.
*/
- dissected = call_dissector_with_data(handle, data_tvb, pinfo, spdy_tree, media_str);
+ dissected = call_dissector_with_data(handle, data_tvb, pinfo, spdy_tree, &message_info);
} else {
dissected = FALSE;
}
@@ -925,7 +932,7 @@ static int dissect_spdy_data_payload(tvbuff_t *tvb,
* Calling the default media handle if there is a content-type that
* wasn't handled above.
*/
- call_dissector_with_data(media_handle, next_tvb, pinfo, spdy_tree, media_str);
+ call_dissector_with_data(media_handle, next_tvb, pinfo, spdy_tree, &message_info);
} else {
/* Call the default data dissector */
call_data_dissector(next_tvb, pinfo, spdy_tree);
@@ -1328,8 +1335,9 @@ static int dissect_spdy_header_payload(
*/
if (content_type != NULL && !pinfo->fd->flags.visited) {
gchar *content_type_params = spdy_parse_content_type(content_type);
- spdy_save_stream_info(conv_data, stream_id, content_type,
- content_type_params, content_encoding);
+ spdy_save_stream_info(conv_data, stream_id,
+ (hdr_status == NULL) ? HTTP_REQUEST : HTTP_RESPONSE,
+ content_type, content_type_params, content_encoding);
}
return frame->length;