You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-commits@axis.apache.org by na...@apache.org on 2010/07/22 13:04:19 UTC

svn commit: r966576 - /axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c

Author: nandika
Date: Thu Jul 22 11:04:19 2010
New Revision: 966576

URL: http://svn.apache.org/viewvc?rev=966576&view=rev
Log:
mtom issue with chunking corrected

Modified:
    axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c

Modified: axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c?rev=966576&r1=966575&r2=966576&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c (original)
+++ axis/axis2/c/core/trunk/src/core/transport/http/util/http_transport_utils.c Thu Jul 22 11:04:19 2010
@@ -335,6 +335,7 @@ axis2_http_transport_utils_process_http_
     axis2_char_t *mime_boundary = NULL;
     axis2_bool_t check_for_fault = AXIS2_FALSE;
     axis2_bool_t has_fault = AXIS2_FALSE;
+	axis2_char_t *encoding_header_value = NULL;
 
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, in_stream, AXIS2_FAILURE);
@@ -375,17 +376,25 @@ axis2_http_transport_utils_process_http_
             AXIS2_ACTION);
     }
 
-    headers = axis2_msg_ctx_get_transport_headers(msg_ctx, env);
-    if(headers)
+	headers = axis2_msg_ctx_get_transport_headers(msg_ctx, env);
+    
+	encoding_header_value = axis2_msg_ctx_get_transfer_encoding(msg_ctx, env);
+
+    if(encoding_header_value && axutil_strstr(encoding_header_value, AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
+    {
+        /* In case Transfer encoding is set to message context, some streams strip chunking meta
+         data, so chunked streams should not be created */
+
+        callback_ctx->content_length = -1;
+        callback_ctx->unread_len = -1;
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[chunked ] setting length to -1");
+    }else if(headers)
     {
         axis2_http_header_t *encoding_header = NULL;
         encoding_header = (axis2_http_header_t *)axutil_hash_get(headers,
             AXIS2_HTTP_HEADER_TRANSFER_ENCODING, AXIS2_HASH_KEY_STRING);
 
-        if((encoding_header)&& (!strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_MULTIPART_RELATED)))
-            /* (strstr(content_type, AXIS2_HTTP_HEADER_ACCEPT_MULTIPART_RELATED)) is a hack. we have to fix it properly. When 
-            combining chunking and MTOM it is not working. Normal MTOM processing takes care of the chunking as well. so, 
-            we don't need to specifically read using chunked_stream. But, this is not a proper way to do it. FIX IT */
+        if(encoding_header)
         {
             axis2_char_t *encoding_value = NULL;
             encoding_value = axis2_http_header_get_value(encoding_header, env);
@@ -405,23 +414,22 @@ axis2_http_transport_utils_process_http_
                     " stream chunked");
             }
         }
-    }
+    }/*
     else
     {
-        /* Encoding header is not available */
-        /* check content encoding from msg ctx property */
+        
         axis2_char_t *value = axis2_msg_ctx_get_transfer_encoding(msg_ctx, env);
 
         if(value && axutil_strstr(value, AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
         {
-            /* In case Transfer encoding is set to message context, some streams strip chunking meta
-             data, so chunked streams should not be created */
+            // In case Transfer encoding is set to message context, some streams strip chunking meta
+            // data, so chunked streams should not be created 
 
             callback_ctx->content_length = -1;
             callback_ctx->unread_len = -1;
             AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[chunked ] setting length to -1");
         }
-    }
+    }*/
 
     /* when the message contains does not contain pure XML we can't send it 
      * directly to the parser, First we need to separate the SOAP part from