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/03/15 20:50:50 UTC

svn commit: r637456 - /webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c

Author: senaka
Date: Sat Mar 15 12:50:45 2008
New Revision: 637456

URL: http://svn.apache.org/viewvc?rev=637456&view=rev
Log:
Fixing bug in setting User-Agent Header when resending

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

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=637456&r1=637455&r2=637456&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c Sat Mar 15 12:50:45 2008
@@ -699,8 +699,31 @@
                         tmp1 = axutil_strdup(env, request_buffer);
                         req_content_len -= (int)strlen(tmp1);
                         tmp1 = str_replace(tmp1, ";\n\t", "; ");
-                        tmp1 = str_replace(tmp1, "User-Agent: Axis2/C\r\n", "User-Agent: Axis2/C TCPMon\r\n");
                         req_header = tmp1;
+                        tmp2 = strstr(req_header, "User-Agent:");
+                        if (tmp2)
+                        {
+                            tmp3 = strstr(tmp2, "\r\n");
+                            if (tmp3)
+                            {
+                                int header_len = 0;
+                                axis2_char_t *user_agent = "User-Agent: Axis2/C TCPMon";
+                                header_len = (int)(tmp3 - tmp2) + 2;
+                                tmp1 = AXIS2_MALLOC(env->allocator,
+                                                    sizeof(axis2_char_t) * header_len + 1);
+                                memcpy(tmp1, tmp2, header_len);
+                                tmp1[header_len] = '\0';
+                                header_len = 2 + strlen(user_agent);
+                                tmp2 = AXIS2_MALLOC(env->allocator,
+                                                    sizeof(axis2_char_t) * (header_len + 1));
+                                sprintf(tmp2, "%s\r\n", user_agent);
+                                req_header = str_replace(req_header, tmp1, tmp2);
+                                AXIS2_FREE(env->allocator, tmp1);
+                                AXIS2_FREE(env->allocator, tmp2);
+                                tmp1 = NULL;
+                                tmp2 = NULL;
+                            }
+                        }
                         if (!has_raw_binary)
                         {
                             tmp2 = strstr(req_header, "Content-Length:");



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