You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by se...@apache.org on 2008/02/20 15:15:47 UTC

svn commit: r629466 - in /webservices/axis2/trunk/c/tools/tcpmon/src: entry.c tcpmon.c

Author: senaka
Date: Wed Feb 20 06:15:46 2008
New Revision: 629466

URL: http://svn.apache.org/viewvc?rev=629466&view=rev
Log:
Fixing JIRA Issue AXIS2C-996

Modified:
    webservices/axis2/trunk/c/tools/tcpmon/src/entry.c
    webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c

Modified: webservices/axis2/trunk/c/tools/tcpmon/src/entry.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/entry.c?rev=629466&r1=629465&r2=629466&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/entry.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/entry.c Wed Feb 20 06:15:46 2008
@@ -640,6 +640,7 @@
     int length = -1;
     int chunked_encoded = 0;
     int is_get = 0;
+    int zero_content_length = 0;
 
     buffer = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t));
     *data = NULL;
@@ -671,6 +672,10 @@
                 {
                     length_char++;
                     length = atoi(length_char);
+                    if (length == 0)
+                    {
+                        zero_content_length = 1;
+                    }
                 }
             }
             if (strstr(current_line, "GET") || strstr(current_line, "HEAD")
@@ -761,11 +766,15 @@
         }
     }
     while (length != 0);
-
+    
     if (is_get)
     {
         read_size++;
     }
+    else if (zero_content_length)
+    {
+        read_size += 3;
+    }
 
     buffer = AXIS2_REALLOC(env->allocator, buffer,
                            sizeof(axis2_char_t) * (read_size + 1));
@@ -782,17 +791,24 @@
     }
     else
     {
-        if (header_ptr)
-        {
-            AXIS2_FREE(env->allocator, header_ptr);
-        }
-        header_ptr = (axis2_char_t *) axutil_strdup(env, buffer);
         /** soap body part is unavailable */
         if (is_get)
         {
             *data = (axis2_char_t *) axutil_strdup(env, "\n");
             *(buffer + read_size - 1) = '\n';
         }
+        else if (zero_content_length)
+        {
+            *data = (axis2_char_t *) axutil_strdup(env, "\n");
+            *(buffer + read_size - 3) = '\n';
+            *(buffer + read_size - 2) = '\r';
+            *(buffer + read_size - 1) = '\n';
+        }
+        if (header_ptr)
+        {
+            AXIS2_FREE(env->allocator, header_ptr);
+        }
+        header_ptr = (axis2_char_t *) axutil_strdup(env, buffer);
     }
 
     *header = header_ptr;

Modified: webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c?rev=629466&r1=629465&r2=629466&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c Wed Feb 20 06:15:46 2008
@@ -272,16 +272,17 @@
         {
             free(convert);
         }
-
-        convert = axutil_strdup(env, formated_buffer);
-        convert = str_replace(convert, "; ", ";\n\t");
-        convert = str_replace(convert, "><", ">\n<");
-        fprintf(file, "%s", convert);
-        if (convert)
+        if (strcmp(formated_buffer, "") != 0)
         {
-            free(convert);
+            convert = axutil_strdup(env, formated_buffer);
+            convert = str_replace(convert, "; ", ";\n\t");
+            convert = str_replace(convert, "><", ">\n<");
+            fprintf(file, "%s", convert);
+            if (convert)
+            {
+                free(convert);
+            }
         }
-
     }
     if (status == 1)
     {
@@ -321,13 +322,16 @@
         {
             free(convert);
         }
-        convert = axutil_strdup(env, formated_buffer);
-        convert = str_replace(convert, "; ", ";\n\t");
-        convert = str_replace(convert, "><", ">\n<");
-        fprintf(file, "%s", convert);
-        if (convert)
+        if (strcmp(formated_buffer, "") != 0)
         {
-            free(convert);
+            convert = axutil_strdup(env, formated_buffer);
+            convert = str_replace(convert, "; ", ";\n\t");
+            convert = str_replace(convert, "><", ">\n<");
+            fprintf(file, "%s", convert);
+            if (convert)
+            {
+                free(convert);
+            }
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org