axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From din...@apache.org
Subject svn commit: r642896 - in /webservices/axis2/trunk/c: include/axis2_http_transport.h src/core/transport/http/common/http_out_transport_info.c src/core/transport/http/common/http_request_line.c
Date Mon, 31 Mar 2008 06:24:23 GMT
Author: dinesh
Date: Sun Mar 30 23:24:19 2008
New Revision: 642896

URL: http://svn.apache.org/viewvc?rev=642896&view=rev
Log:
added more log messages and replaced strings with macros

Modified:
    webservices/axis2/trunk/c/include/axis2_http_transport.h
    webservices/axis2/trunk/c/src/core/transport/http/common/http_out_transport_info.c
    webservices/axis2/trunk/c/src/core/transport/http/common/http_request_line.c

Modified: webservices/axis2/trunk/c/include/axis2_http_transport.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_http_transport.h?rev=642896&r1=642895&r2=642896&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_transport.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_transport.h Sun Mar 30 23:24:19 2008
@@ -987,6 +987,8 @@
 
 #define AXIS2_CONTENT_TYPE_CHARSET ";charset="
 
+#define AXIS2_CHARSET "charset"
+
 #define AXIS2_PORT_STRING "port"
 
 #define AXIS2_DEFAULT_HOST_ADDRESS "127.0.0.1"
@@ -1008,6 +1010,8 @@
 #define AXIS2_SPACE ' '
 
 #define AXIS2_RETURN '\r'
+
+#define AXIS2_F_SLASH '/'
     /** @} */
 
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_out_transport_info.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_out_transport_info.c?rev=642896&r1=642895&r2=642896&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_out_transport_info.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_out_transport_info.c Sun
Mar 30 23:24:19 2008
@@ -31,8 +31,10 @@
     const axutil_env_t * env,
     const axis2_char_t * content_type)
 {
-    return axis2_http_out_transport_info_set_content_type(AXIS2_INTF_TO_IMPL(out_transport_info),
-        env, content_type);
+    axis2_http_out_transport_info_t *http_transport_info = NULL;
+    http_transport_info = AXIS2_INTF_TO_IMPL(out_transport_info);
+    return axis2_http_out_transport_info_set_content_type(http_transport_info,
+                                                          env, content_type);
 }
 
 axis2_status_t AXIS2_CALL
@@ -41,8 +43,10 @@
     const axutil_env_t * env,
     const axis2_char_t * encoding)
 {
-    return axis2_http_out_transport_info_set_char_encoding(AXIS2_INTF_TO_IMPL(out_transport_info),
-        env, encoding);
+    axis2_http_out_transport_info_t *http_transport_info = NULL;
+    http_transport_info = AXIS2_INTF_TO_IMPL(out_transport_info);
+    return axis2_http_out_transport_info_set_char_encoding(http_transport_info,
+                                                           env, encoding);
 }
 
 void AXIS2_CALL
@@ -50,7 +54,9 @@
     axis2_out_transport_info_t * out_transport_info,
     const axutil_env_t * env)
 {
-    axis2_http_out_transport_info_free(AXIS2_INTF_TO_IMPL(out_transport_info), env);
+    axis2_http_out_transport_info_t *http_transport_info = NULL;
+    http_transport_info = AXIS2_INTF_TO_IMPL(out_transport_info);
+    axis2_http_out_transport_info_free(http_transport_info, env);
     return;
 }
 
@@ -60,6 +66,7 @@
     axis2_out_transport_info_impl_free
 };
 
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_http_out_transport_info_impl_set_content_type(
     axis2_http_out_transport_info_t * http_out_transport_info,
@@ -69,51 +76,60 @@
     axis2_char_t *tmp1 = NULL;
     axis2_char_t *tmp2 = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, content_type, AXIS2_FAILURE);
     if (http_out_transport_info->encoding)
     {
-        axis2_char_t *charset_pos = axutil_strcasestr(content_type, "charset");
+        axis2_char_t *charset_pos = axutil_strcasestr(content_type, 
+                                                      AXIS2_CHARSET);
         if (!charset_pos)
         {
-            tmp1 = axutil_stracat(env, content_type, ";charset=");
+            /* if "charset" not found in content_type string */
+            tmp1 = axutil_stracat(env, content_type, 
+                                  AXIS2_CONTENT_TYPE_CHARSET);
             tmp2 = axutil_stracat(env, tmp1, http_out_transport_info->encoding);
             axis2_http_simple_response_set_header(http_out_transport_info->
                                                   response, env,
-                                                  axis2_http_header_create(env,
-                                                                           AXIS2_HTTP_HEADER_CONTENT_TYPE,
-                                                                           tmp2));
+                                                  axis2_http_header_create(
+                                                      env,
+                                                      AXIS2_HTTP_HEADER_CONTENT_TYPE,
+                                                      tmp2));
             AXIS2_FREE(env->allocator, tmp1);
             AXIS2_FREE(env->allocator, tmp2);
         }
         else
         {
+            /* "charset" is found in content_type string */
             axis2_http_simple_response_set_header(http_out_transport_info->
                                                   response, env,
-                                                  axis2_http_header_create(env,
-                                                                           AXIS2_HTTP_HEADER_CONTENT_TYPE,
-                                                                           content_type));
+                                                  axis2_http_header_create(
+                                                      env,
+                                                      AXIS2_HTTP_HEADER_CONTENT_TYPE,
+                                                      content_type));
         }
     }
     else
     {
+        /* no http_out_transport_info->encoding  */
         if (http_out_transport_info->response)
+        {
             axis2_http_simple_response_set_header(http_out_transport_info->
                                                   response, env,
-                                                  axis2_http_header_create(env,
-                                                                           AXIS2_HTTP_HEADER_CONTENT_TYPE,
-                                                                           content_type));
+                                                  axis2_http_header_create(
+                                                      env,
+                                                      AXIS2_HTTP_HEADER_CONTENT_TYPE,
+                                                      content_type));
+        }
     }
     return AXIS2_SUCCESS;
 }
 
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_http_out_transport_info_impl_set_char_encoding(
     axis2_http_out_transport_info_t * http_out_transport_info,
     const axutil_env_t * env,
     const axis2_char_t * encoding)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, encoding, AXIS2_FAILURE);
     if (http_out_transport_info->encoding)
     {
@@ -123,12 +139,18 @@
     return AXIS2_SUCCESS;
 }
 
+
 AXIS2_EXTERN void AXIS2_CALL
 axis2_http_out_transport_info_impl_free(
     axis2_http_out_transport_info_t * http_out_transport_info,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
+
+    if (!http_out_transport_info)
+    {
+        return;
+    }
+
     if (http_out_transport_info->response)
     {
         axis2_http_simple_response_free(http_out_transport_info->response, env);
@@ -141,22 +163,24 @@
     return;
 }
 
+
 AXIS2_EXTERN axis2_http_out_transport_info_t *AXIS2_CALL
 axis2_http_out_transport_info_create(
     const axutil_env_t * env,
     axis2_http_simple_response_t * response)
 {
     axis2_http_out_transport_info_t *http_out_transport_info = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     http_out_transport_info = (axis2_http_out_transport_info_t *) AXIS2_MALLOC
         (env->allocator, sizeof(axis2_http_out_transport_info_t));
 
     if (!http_out_transport_info)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
+    memset ((void *)http_out_transport_info, 0, 
+            sizeof (axis2_http_out_transport_info_t));
     http_out_transport_info->out_transport.ops = &ops_var;
     http_out_transport_info->response = response;
     http_out_transport_info->encoding = NULL;
@@ -190,7 +214,6 @@
 {
     axis2_http_out_transport_info_t *transport_info_l = NULL;
 
-    AXIS2_ENV_CHECK(env, void);
     transport_info_l = AXIS2_INTF_TO_IMPL(transport_info);
     axis2_http_out_transport_info_free(transport_info_l, env);
     return;
@@ -216,6 +239,7 @@
                                                       env, encoding);
 }
 
+
 AXIS2_EXTERN void AXIS2_CALL
 axis2_http_out_transport_info_set_char_encoding_func(
     axis2_http_out_transport_info_t * out_transport_info,
@@ -228,6 +252,7 @@
     out_transport_info->set_char_encoding = set_char_encoding;
 }
 
+
 AXIS2_EXTERN void AXIS2_CALL
 axis2_http_out_transport_info_set_content_type_func(
     axis2_http_out_transport_info_t * out_transport_info,
@@ -240,6 +265,7 @@
     out_transport_info->set_content_type = set_content_type;
 }
 
+
 AXIS2_EXTERN void AXIS2_CALL
 axis2_http_out_transport_info_set_free_func(
     axis2_http_out_transport_info_t * out_transport_info,
@@ -249,3 +275,6 @@
 {
     out_transport_info->free_function = free_function;
 }
+
+
+

Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_request_line.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_request_line.c?rev=642896&r1=642895&r2=642896&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_request_line.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_request_line.c Sun Mar 30
23:24:19 2008
@@ -37,7 +37,7 @@
     const axis2_char_t * http_version)
 {
     axis2_http_request_line_t *request_line = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
+
     AXIS2_PARAM_CHECK(env->error, method, NULL);
     AXIS2_PARAM_CHECK(env->error, uri, NULL);
     AXIS2_PARAM_CHECK(env->error, http_version, NULL);
@@ -47,9 +47,10 @@
 
     if (!request_line)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
+    memset ((void *)request_line, 0, sizeof (axis2_http_request_line_t));
     request_line->method = (axis2_char_t *) axutil_strdup(env, method);
     request_line->uri = (axis2_char_t *) axutil_strdup(env, uri);
     request_line->http_version =
@@ -63,7 +64,11 @@
     axis2_http_request_line_t * request_line,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
+
+    if (!request_line)
+    {
+        return;
+    }
 
     if (request_line->method)
     {
@@ -82,6 +87,7 @@
     return;
 }
 
+
 AXIS2_EXTERN axis2_http_request_line_t *AXIS2_CALL
 axis2_http_request_line_parse_line(
     const axutil_env_t * env,
@@ -101,45 +107,46 @@
 
     if (!tmp)
     {
-        AXIS2_ERROR_SET(env->error,
-                        AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
-                        AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env,
+                           AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
+                           AXIS2_FAILURE);
         return NULL;
     }
+
     i = (int)(tmp - str);
     /* We are sure that the difference lies within the int range */
     req_line = AXIS2_MALLOC(env->allocator, i * sizeof(axis2_char_t) + 1);
     if (!req_line)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
     memcpy(req_line, str, i * sizeof(axis2_char_t));
-    req_line[i] = '\0';
+    req_line[i] = AXIS2_ESC_NULL;
     tmp = req_line;
 
     method = tmp;
-    tmp = strchr(tmp, ' ');
+    tmp = strchr(tmp, AXIS2_SPACE);
     if (!tmp)
     {
         AXIS2_FREE(env->allocator, req_line);
-        AXIS2_ERROR_SET(env->error,
-                        AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
-                        AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env,
+                           AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
+                           AXIS2_FAILURE);
         return NULL;
     }
-    *tmp++ = '\0';
+    *tmp++ = AXIS2_ESC_NULL;
     uri = tmp;
-    tmp = strrchr(tmp, ' ');
+    tmp = strrchr(tmp, AXIS2_SPACE);
     if (!tmp)
     {
         AXIS2_FREE(env->allocator, req_line);
-        AXIS2_ERROR_SET(env->error,
-                        AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
-                        AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env,
+                           AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
+                           AXIS2_FAILURE);
         return NULL;
     }
-    *tmp++ = '\0';
+    *tmp++ = AXIS2_ESC_NULL;
     http_version = tmp;
     ret = axis2_http_request_line_create(env, method, uri, http_version);
     AXIS2_FREE(env->allocator, req_line);
@@ -179,8 +186,6 @@
     int alloc_len = 0;
     axis2_char_t *ret = NULL;
 
-    AXIS2_ENV_CHECK(env, NULL);
-
     alloc_len = axutil_strlen(request_line->method) +
         axutil_strlen(request_line->uri) +
         axutil_strlen(request_line->http_version) + 6;
@@ -189,10 +194,11 @@
     ret = AXIS2_MALLOC(env->allocator, alloc_len * sizeof(axis2_char_t));
     if (!ret)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
-    if (request_line->uri[0] != '/')
+
+    if (request_line->uri[0] != AXIS2_F_SLASH)
     {
         sprintf(ret, "%s /%s %s%s", request_line->method, request_line->uri,
                 request_line->http_version, AXIS2_HTTP_CRLF);



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


Mime
View raw message