You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2007/12/11 12:49:46 UTC

svn commit: r603217 - in /webservices/axis2/trunk/c: samples/user_guide/clients/echo_blocking_auth.c src/core/transport/http/sender/libcurl/axis2_libcurl.c

Author: dinesh
Date: Tue Dec 11 03:49:41 2007
New Revision: 603217

URL: http://svn.apache.org/viewvc?rev=603217&view=rev
Log:
fixed:axis2c-809 thanks Bill Mitchell for the patch

Modified:
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_auth.c
    webservices/axis2/trunk/c/src/core/transport/http/sender/libcurl/axis2_libcurl.c

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_auth.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_auth.c?rev=603217&r1=603216&r2=603217&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_auth.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_auth.c Tue Dec 11 03:49:41 2007
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -38,8 +37,6 @@
     axis2_svc_client_t *svc_client = NULL;
     axiom_node_t *payload = NULL;
     axiom_node_t *ret_node = NULL;
-    axiom_node_t *payload2 = NULL;
-    axiom_node_t *ret_node2 = NULL;
     const axis2_char_t *un = NULL;
     const axis2_char_t *pw = NULL;
     const axis2_char_t *unp = NULL;

Modified: webservices/axis2/trunk/c/src/core/transport/http/sender/libcurl/axis2_libcurl.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/sender/libcurl/axis2_libcurl.c?rev=603217&r1=603216&r2=603217&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/sender/libcurl/axis2_libcurl.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/sender/libcurl/axis2_libcurl.c Tue Dec 11 03:49:41 2007
@@ -28,6 +28,7 @@
     axutil_array_list_t *alist;
     unsigned int size;
     const axutil_env_t *env;
+    char errorbuffer[CURL_ERROR_SIZE];
 } axis2_libcurl_t;
 
 size_t axis2_libcurl_write_memory_callback(
@@ -83,6 +84,10 @@
     int output_stream_size = 0;
 
     data = axis2_libcurl_create(env);
+    if (!data) 
+    {
+        return AXIS2_FAILURE;
+    }
     if (!ref)
     {
         handler = curl_easy_init();
@@ -92,6 +97,7 @@
     {
         curl_easy_reset(handler);
     }
+    curl_easy_setopt(handler, CURLOPT_ERRORBUFFER, &data->errorbuffer);
     headers = curl_slist_append(headers, AXIS2_HTTP_HEADER_USER_AGENT_AXIS2C);
     headers = curl_slist_append(headers, AXIS2_HTTP_HEADER_ACCEPT_);
     headers = curl_slist_append(headers, AXIS2_HTTP_HEADER_EXPECT_);
@@ -111,11 +117,13 @@
                             AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "%s",
                             AXIS2_ERROR_GET_MESSAGE(env->error));
+            axis2_libcurl_free(data, env);
             return AXIS2_FAILURE;
         }
         body_node = axiom_soap_body_get_base_node(soap_body, env);
         if (!body_node)
         {
+            axis2_libcurl_free(data, env);
             return AXIS2_FAILURE;
         }
         data_out = axiom_node_get_first_element(body_node, env);
@@ -321,7 +329,14 @@
 /* 	curl_easy_setopt (handler, CURLOPT_HEADERFUNCTION, axis2_libcurl_header_callback); */
 
 /* 	curl_easy_setopt (handler, CURLOPT_WRITEHEADER, header); */
-    curl_easy_perform(handler);
+    if (curl_easy_perform(handler)) 
+    {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "%s", &data->errorbuffer);
+        AXIS2_ERROR_SET (env->error, AXIS2_ERROR_HTTP_CLIENT_TRANSPORT_ERROR,
+                         AXIS2_FAILURE);
+        axis2_libcurl_free(data, env);
+        return AXIS2_FAILURE;
+    }
 
 /* 	curl_slist_free_all (headers); */
 
@@ -335,6 +350,8 @@
     axutil_property_set_value(trans_in_property, env, in_stream);
     axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_TRANSPORT_IN,
                                trans_in_property);
+
+    axis2_libcurl_free(data, env);
     return AXIS2_SUCCESS;
 }
 
@@ -393,9 +410,12 @@
     curl =
         (axis2_libcurl_t *) AXIS2_MALLOC(env->allocator,
                                          sizeof(axis2_libcurl_t));
-    curl->size = 0;
-    curl->alist = axutil_array_list_create(env, 7);
-    curl->env = env;
+    if (curl) 
+    {
+        curl->size = 0;
+        curl->alist = axutil_array_list_create(env, 7);
+        curl->env = env;
+    }
     return curl;
 }
 



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