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 sh...@apache.org on 2010/03/11 05:03:20 UTC

svn commit: r921684 - in /axis/axis2/c/core/trunk: include/axis2_http_client.h src/core/transport/http/sender/http_client.c src/core/transport/http/sender/http_sender.c

Author: shankar
Date: Thu Mar 11 04:03:19 2010
New Revision: 921684

URL: http://svn.apache.org/viewvc?rev=921684&view=rev
Log:
Fixing issue AXIS2C-1468

Modified:
    axis/axis2/c/core/trunk/include/axis2_http_client.h
    axis/axis2/c/core/trunk/src/core/transport/http/sender/http_client.c
    axis/axis2/c/core/trunk/src/core/transport/http/sender/http_sender.c

Modified: axis/axis2/c/core/trunk/include/axis2_http_client.h
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/include/axis2_http_client.h?rev=921684&r1=921683&r2=921684&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/include/axis2_http_client.h (original)
+++ axis/axis2/c/core/trunk/include/axis2_http_client.h Thu Mar 11 04:03:19 2010
@@ -261,6 +261,16 @@ extern "C"
         const axutil_env_t * env,
         axis2_char_t *callback_name);
 
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axis2_http_client_consume_stream(
+        axis2_http_client_t * client,
+        const axutil_env_t * env);
+
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    axis2_http_client_reset(
+        axis2_http_client_t * client,
+        const axutil_env_t * env);
+
 
     /** @} */
 #ifdef __cplusplus

Modified: axis/axis2/c/core/trunk/src/core/transport/http/sender/http_client.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/src/core/transport/http/sender/http_client.c?rev=921684&r1=921683&r2=921684&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/src/core/transport/http/sender/http_client.c (original)
+++ axis/axis2/c/core/trunk/src/core/transport/http/sender/http_client.c Thu Mar 11 04:03:19 2010
@@ -190,11 +190,11 @@ axis2_http_client_send(
     /* In the MTOM case request body is not set. Instead mime_parts
      array_list is there */
 
-    if(client->req_body)
+    /*if(client->req_body)
     {
         AXIS2_FREE(env->allocator, client->req_body);
         client->req_body = NULL;
-    }
+    }*/
     if(!client->req_body && !(client->doing_mtom))
     {
         client->req_body_size = axis2_http_simple_request_get_body_bytes(request, env,
@@ -963,3 +963,32 @@ axis2_http_client_set_mtom_sending_callb
     client->mtom_sending_callback_name = callback_name;
     return AXIS2_SUCCESS;
 }
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_http_client_consume_stream(
+    axis2_http_client_t * client,
+    const axutil_env_t * env)
+{
+    /*axutil_stream_close(client->data_stream, env);*/
+    axis2_char_t tmp_buffer[512];
+    int read;
+    
+    while((read = axutil_stream_read(client->data_stream, env, tmp_buffer, 511)) == 511)
+    {
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_http_client_reset(
+    axis2_http_client_t * client,
+    const axutil_env_t * env)
+{
+    if(client->req_body)
+    {
+        AXIS2_FREE(env->allocator, client->req_body);
+        client->req_body = NULL;
+    }
+    return AXIS2_SUCCESS;
+}
\ No newline at end of file

Modified: axis/axis2/c/core/trunk/src/core/transport/http/sender/http_sender.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/src/core/transport/http/sender/http_sender.c?rev=921684&r1=921683&r2=921684&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/src/core/transport/http/sender/http_sender.c (original)
+++ axis/axis2/c/core/trunk/src/core/transport/http/sender/http_sender.c Thu Mar 11 04:03:19 2010
@@ -1190,6 +1190,9 @@ header");
 
     if(AXIS2_HTTP_RESPONSE_HTTP_UNAUTHORIZED_CODE_VAL == status_code && !test_http_auth)
     {
+        /* consume the buffer */
+        axis2_http_client_consume_stream(sender->client, env);
+
         if(!http_auth_header_added)
         {
             if(force_proxy_auth_with_head)
@@ -3292,6 +3295,10 @@ axis2_http_sender_connection_map_get(
                 if(server)
                 {
                     http_client = axutil_hash_get(connection_map, server, AXIS2_HASH_KEY_STRING);
+                    if(http_client)
+                    {
+                        axis2_http_client_reset(http_client, env);
+                    }
                 }
                 axutil_url_free(url, env);
             }