Ethereal-dev: Re: [Ethereal-dev] HTTP chunked encoding and protocol hierarchy

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jerry Talkington <jtalkington@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Apr 2004 05:31:46 -0700
On Tue, Apr 27, 2004 at 08:16:48AM -0700, Jerry Talkington wrote:
> On Tue, Apr 27, 2004 at 03:35:09PM +0200, Biot Olivier wrote:
>  
> > Should the chunked decoding appear as a subitem to the HTTP tree, or as a
> > "protocol"? Personally I'm more in favor of the 1st option.
> 
> Now that I know it exists, I'm more in favor of a third option: making
> it an option.  If the hierarchy statistics are simply pulled from the
> middle pane, it should be a snap to add options allowing the user to
> specify where to stick it.
> 
> If nobody objects, I'll re-implement the chunked decoder as a
> "protocol", and give the user an option of including it in the protocol
> statistics.  I'll also give the user the option of including the
> content-encoding, and media types in the hiearchy (I can't imagine
> having "Line-based text data" is usefull to anybody, but the actual
> media type would be, so I'll stick the text data under the media type.)

The more I think about this/look at the code, the less I like this idea.
There doesn't really seem to be a way to add media types to the protocol
hierachy without creating a dissector for each one encountered.

I have a couple ideas for a generic dissector (i.e. you pass the name
and desciption, and a data dissector is created on the fly,) but I'm not
sure how worthwhile it would be, I'll have to do some more
investigation.

In the meantime, here's a patch to move the Chunked response and encoded
entity body items to the HTTP tree.

-- 
GPG public key:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x9D5B8762
Index: AUTHORS
===================================================================
RCS file: /cvsroot/ethereal/AUTHORS,v
retrieving revision 1.1002
diff -u -r1.1002 AUTHORS
--- AUTHORS	28 Apr 2004 15:38:32 -0000	1.1002
+++ AUTHORS	29 Apr 2004 12:19:11 -0000
@@ -286,6 +286,7 @@
 }
 
 Jerry Talkington <jtalkington[AT]users.sourceforge.net> {
+	HTTP chunked encoding dissection
 	updates to HTTP support
 	Filter selection/editing GUI improvements
 	WCCP 1.0 support
Index: packet-http.c
===================================================================
RCS file: /cvsroot/ethereal/packet-http.c,v
retrieving revision 1.97
diff -u -r1.97 packet-http.c
--- packet-http.c	26 Apr 2004 17:10:40 -0000	1.97
+++ packet-http.c	29 Apr 2004 12:19:12 -0000
@@ -3,6 +3,7 @@
  *
  * Guy Harris <guy@xxxxxxxxxxxx>
  *
+ * Copyright 2004, Jerry Talkington <jtalkington@xxxxxxxxxxxxxxxxxxxxx>
  * Copyright 2002, Tim Potter <tpot@xxxxxxxxx>
  * Copyright 1999, Andrew Tridgell <tridge@xxxxxxxxx>
  *
@@ -622,7 +623,7 @@
 			    == 0) {
 
 				chunks_decoded = chunked_encoding_dissector(
-				    &next_tvb, pinfo, tree, 0);
+				    &next_tvb, pinfo, http_tree, 0);
 
 				if (chunks_decoded <= 0) {
 					/* 
@@ -657,28 +658,18 @@
 			 * "compress", or "deflate"; just handle them as
 			 * data for now.
 			 */
-			if (chunks_decoded != 0) {
-				/*
-				 * There is a chunked response tree, so put
-				 * the entity body below it.
-				 */
-				proto_item *e_ti = NULL;
-				proto_tree *e_tree = NULL;
+			proto_item *e_ti = NULL;
+			proto_tree *e_tree = NULL;
 
-				e_ti = proto_tree_add_text(tree, next_tvb,
-				    0, tvb_length(next_tvb),
-				    "Encoded entity-body (%s)",
-				    headers.content_encoding);
+			e_ti = proto_tree_add_text(http_tree, next_tvb, 0,
+			    tvb_length(next_tvb), "Encoded entity-body (%s)",
+			    headers.content_encoding);
 
-				e_tree = proto_item_add_subtree(e_ti,
-				    ett_http_encoded_entity);
+			e_tree = proto_item_add_subtree(e_ti,
+			    ett_http_encoded_entity);
 
-				call_dissector(data_handle, next_tvb, pinfo,
-				    e_tree);
-			} else {
-				call_dissector(data_handle, next_tvb, pinfo,
-				    http_tree);
-			}
+			call_dissector(data_handle, next_tvb, pinfo, e_tree);
+			
 			goto body_dissected;
 		}