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 su...@apache.org on 2008/06/26 08:54:50 UTC

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

Author: supun
Date: Wed Jun 25 23:54:50 2008
New Revision: 671808

URL: http://svn.apache.org/viewvc?rev=671808&view=rev
Log:
Fixing AXIS2C-1075. Thanks Rajika

Modified:
    webservices/axis2/trunk/c/tools/tcpmon/src/entry.c
    webservices/axis2/trunk/c/tools/tcpmon/src/session.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=671808&r1=671807&r2=671808&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/entry.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/entry.c Wed Jun 25 23:54:50 2008
@@ -427,7 +427,7 @@
     axutil_thread_t * thd,
     void *data)
 {
-    tcpmon_entry_request_data_t *req_data = data;
+    tcpmon_entry_request_data_t *req_data = (tcpmon_entry_request_data_t *) data;
     const axutil_env_t *env = NULL;
     int client_socket = -1;
     int host_socket = -1;
@@ -464,7 +464,6 @@
 
     target_port = TCPMON_SESSION_GET_TARGET_PORT(session, env);
     target_host = TCPMON_SESSION_GET_TARGET_HOST(session, env);
-
     if (target_port == -1 || target_host == NULL)
     {
         axutil_network_handler_close_socket(env, client_socket);
@@ -508,8 +507,9 @@
     }
 
     buffer = read_current_stream(client_stream, env, &buffer_size,
-                                 &headers, &content);
+            &headers, &content);
 
+    headers =(char *) str_replace(headers,"localhost", target_host);
     test_bit = TCPMON_SESSION_GET_TEST_BIT(session, env);
 
     if (test_bit)
@@ -531,7 +531,7 @@
 
     /*free ( localTime); */
 
-    entry_impl->sent_headers = headers;
+    entry_impl->sent_headers = headers; 
     entry_impl->sent_data = content;
     entry_impl->sent_data_length = buffer_size;
 

Modified: webservices/axis2/trunk/c/tools/tcpmon/src/session.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/session.c?rev=671808&r1=671807&r2=671808&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/session.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/session.c Wed Jun 25 23:54:50 2008
@@ -372,7 +372,7 @@
     session_impl = AXIS2_INTF_TO_IMPL(session);
 
     session_impl->target_host =
-        (axis2_char_t *) axutil_strdup(env, target_host);
+        (axis2_char_t *) axutil_strdup(env, target_host);  
     return AXIS2_SUCCESS;
 }
 
@@ -492,7 +492,7 @@
     axutil_thread_t * thd,
     void *data)
 {
-    tcpmon_session_server_thread_data_t *thread_data = data;
+    tcpmon_session_server_thread_data_t *thread_data = (tcpmon_session_server_thread_data_t *)data;
     tcpmon_session_impl_t *session_impl = NULL;
     const axutil_env_t *env = NULL;
     int listen_socket = -1;

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=671808&r1=671807&r2=671808&view=diff
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c Wed Jun 25 23:54:50 2008
@@ -73,7 +73,7 @@
     int listen_port = 9099,
         target_port = 9090; /* the default port simple axis2 server is run on 9090  */
     int test_bit = 0;
-    int format_bit = 0;
+    int format_bit = 0;  /* pretty print the request/response SOAP messages */
     int ii = 1;
 
     if (!axutil_strcmp(argv[1], "-h"))
@@ -548,7 +548,7 @@
 
     file = fopen(tcpmon_traffic_log, "rb");
 
-    if (NULL == file)
+    if (!file)
     {
         printf("\ncould not create or open log-file\n");
         return -1;
@@ -778,10 +778,10 @@
                                                     sizeof(axis2_char_t) * header_len + 1);
                                 memcpy(tmp1, tmp2, header_len);
                                 tmp1[header_len] = '\0';
-                                header_len = 16 + (int)strlen(listen_host);
+                                header_len = 16 + (int)strlen(target_host);
                                 tmp2 = AXIS2_MALLOC(env->allocator,
                                                     sizeof(axis2_char_t) * (header_len + 1));
-                                sprintf(tmp2, "%s%s:%d\r\n", AXIS2_HTTP_HEADER_HOST ": ", listen_host,
+                                sprintf(tmp2, "%s%s:%d\r\n", AXIS2_HTTP_HEADER_HOST ": ", target_host,
                                         TCPMON_SESSION_GET_LISTEN_PORT(session, env));
                                 req_header = str_replace(req_header, tmp1, tmp2);
                                 AXIS2_FREE(env->allocator, tmp1);
@@ -1004,7 +1004,7 @@
     {
         free(str_return);
         free(str_tmp);
-        return "function str_replace : gimme more memory";
+        return "function str_replace : give me more memory";
     }
     if (!strcmp(search, replace))
     {
@@ -1039,7 +1039,7 @@
     }
 
     free(str_tmp);
-    free(str);
+    /* free(str); */ /* we are not allocating memory using str */
     str_return[addmem] = '\0';
     return (str_return);
 }