From 6d3c94a53aa8deac5f524248c3dd89c54a92bf5a Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 10 Sep 2006 14:03:08 +0000 Subject: implement support to reassemble tcp sessions until the end of the session (FIN) add required code to the http (and others) code in req_resp_hdrs.c to signal to tcp when it wants a session to be reassembled to the FIN. This is currently done for all HTTP packets where we have a Content-type in the header but no content-length. svn path=/trunk/; revision=19185 --- epan/req_resp_hdrs.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'epan/req_resp_hdrs.c') diff --git a/epan/req_resp_hdrs.c b/epan/req_resp_hdrs.c index cbc861de3e..5696c51558 100644 --- a/epan/req_resp_hdrs.c +++ b/epan/req_resp_hdrs.c @@ -48,6 +48,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, int offset, packet_info *pinfo, gchar *header_val; long int content_length; gboolean content_length_found = FALSE; + gboolean content_type_found = FALSE; gboolean chunked_encoding = FALSE; /* @@ -154,6 +155,9 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, int offset, packet_info *pinfo, == 1) content_length_found = TRUE; g_free(header_val); + } else if (tvb_strncaseeql(tvb, next_offset_sav, + "Content-Type:", 13) == 0) { + content_type_found = TRUE; } else if (tvb_strncaseeql(tvb, next_offset_sav, "Transfer-Encoding:", 18) == 0) { @@ -329,6 +333,27 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, int offset, packet_info *pinfo, } } + } else if (content_type_found && pinfo->can_desegment) { + /* We found a content-type but no content-length. + * This is probably a HTTP header for a session with + * only one HTTP PDU and where the content spans + * until the end of the tcp session. + * Set up tcp reassembly until the end of this session. + */ + length_remaining = tvb_length_remaining(tvb, next_offset); + reported_length_remaining = tvb_reported_length_remaining(tvb, next_offset); + if (length_remaining < reported_length_remaining) { + /* + * It's a waste of time asking for more + * data, because that data wasn't captured. + */ + return TRUE; + } + + pinfo->desegment_offset = offset; + pinfo->desegment_len = DESEGMENT_UNTIL_FIN; + + return FALSE; } } -- cgit v1.2.3