aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2013-09-05 15:48:50 +0000
committerEvan Huus <eapache@gmail.com>2013-09-05 15:48:50 +0000
commit40a83d1e2c548331bff40b630a744ec17e6c3b08 (patch)
treeaeadb863f7be4640c2496f9766bd2122f8f92116
parent8552f0df6431b752511b845ce1f9aaa37a70586b (diff)
As per the HTTP spec, prefer chunked transfer-encoding to content-length if we
get both. Fixes reassembly for https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9101 svn path=/trunk/; revision=51785
-rw-r--r--epan/req_resp_hdrs.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/epan/req_resp_hdrs.c b/epan/req_resp_hdrs.c
index 52592f49cb..81f9167da2 100644
--- a/epan/req_resp_hdrs.c
+++ b/epan/req_resp_hdrs.c
@@ -228,44 +228,7 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
* and next_offset points to after the end of the headers.
*/
if (desegment_body) {
- if (content_length_found) {
- if (content_length >= 128*1024) { /* MS-RPCH stipulate that the content-length must be between 128K and 2G */
- gchar *tmp;
- if (content_type_found &&
- strncmp(content_type, "application/rpc", 15) == 0) {
- /* It looks like a RPC_IN_DATA request or a RPC_OUT_DATA response
- * in which the content-length is meaningless
- */
- return TRUE;
- }
- /* Following sizeof will return the length of the string + \0 we need to not count it*/
- tmp = tvb_get_ephemeral_string(tvb, 0, sizeof("RPC_OUT_DATA") - 1);
- if ((strncmp(tmp, "RPC_IN_DATA", sizeof("RPC_IN_DATA") - 1) == 0) ||
- (strncmp(tmp, "RPC_OUT_DATA", sizeof("RPC_OUT_DATA") - 1) == 0)) {
- return TRUE;
- }
- }
- /* next_offset has been set to the end of the headers */
- if (!tvb_bytes_exist(tvb, next_offset, content_length)) {
- 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;
- }
- if (length_remaining == -1)
- length_remaining = 0;
- pinfo->desegment_offset = offset;
- pinfo->desegment_len =
- content_length - length_remaining;
- return FALSE;
- }
- } else if (chunked_encoding) {
+ if (chunked_encoding) {
/*
* This data is chunked, so we need to keep pulling
* data until we reach the end of the stream, or a
@@ -374,6 +337,43 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo,
}
}
+ } else if (content_length_found) {
+ if (content_length >= 128*1024) { /* MS-RPCH stipulate that the content-length must be between 128K and 2G */
+ gchar *tmp;
+ if (content_type_found &&
+ strncmp(content_type, "application/rpc", 15) == 0) {
+ /* It looks like a RPC_IN_DATA request or a RPC_OUT_DATA response
+ * in which the content-length is meaningless
+ */
+ return TRUE;
+ }
+ /* Following sizeof will return the length of the string + \0 we need to not count it*/
+ tmp = tvb_get_ephemeral_string(tvb, 0, sizeof("RPC_OUT_DATA") - 1);
+ if ((strncmp(tmp, "RPC_IN_DATA", sizeof("RPC_IN_DATA") - 1) == 0) ||
+ (strncmp(tmp, "RPC_OUT_DATA", sizeof("RPC_OUT_DATA") - 1) == 0)) {
+ return TRUE;
+ }
+ }
+ /* next_offset has been set to the end of the headers */
+ if (!tvb_bytes_exist(tvb, next_offset, content_length)) {
+ 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;
+ }
+ if (length_remaining == -1)
+ length_remaining = 0;
+ pinfo->desegment_offset = offset;
+ pinfo->desegment_len =
+ content_length - length_remaining;
+ return FALSE;
+ }
} 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