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 sh...@apache.org on 2009/08/18 12:15:53 UTC
svn commit: r805347 [19/31] - in /webservices/axis2/trunk/c/src: core/addr/
core/clientapi/ core/context/ core/deployment/ core/description/
core/engine/ core/phaseresolver/ core/receivers/
core/transport/amqp/receiver/ core/transport/amqp/receiver/qpi...
Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_header.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_header.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_header.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_header.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -36,17 +35,16 @@
{
axis2_http_header_t *http_header = NULL;
- http_header = (axis2_http_header_t *) AXIS2_MALLOC
- (env->allocator, sizeof(axis2_http_header_t));
+ http_header = (axis2_http_header_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_http_header_t));
- if (!http_header)
+ if(!http_header)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- memset ((void *)http_header, 0, sizeof (axis2_http_header_t));
- http_header->name = (axis2_char_t *) axutil_strdup(env, name);
- http_header->value = (axis2_char_t *) axutil_strdup(env, value);
+ memset((void *)http_header, 0, sizeof(axis2_http_header_t));
+ http_header->name = (axis2_char_t *)axutil_strdup(env, name);
+ http_header->value = (axis2_char_t *)axutil_strdup(env, value);
return http_header;
}
@@ -61,23 +59,22 @@
axis2_char_t *ch2 = NULL;
axis2_http_header_t *ret = NULL;
- AXIS2_PARAM_CHECK (env->error, str, NULL);
+ AXIS2_PARAM_CHECK(env->error, str, NULL);
tmp_str = axutil_strdup(env, str);
- if (!tmp_str)
+ if(!tmp_str)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "unable to strdup string, %s", str);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "unable to strdup string, %s", str);
return NULL;
}
/* remove trailing \r\n */
- if ((axutil_strlen(tmp_str) >= 2) && (AXIS2_RETURN == tmp_str[axutil_strlen(tmp_str) - 2]))
+ if((axutil_strlen(tmp_str) >= 2) && (AXIS2_RETURN == tmp_str[axutil_strlen(tmp_str) - 2]))
{
tmp_str[axutil_strlen(tmp_str) - 2] = AXIS2_ESC_NULL;
}
- ch = strchr((const char *) tmp_str, AXIS2_COLON);
- if (!ch)
+ ch = strchr((const char *)tmp_str, AXIS2_COLON);
+ if(!ch)
{
AXIS2_FREE(env->allocator, tmp_str);
return NULL;
@@ -85,7 +82,7 @@
ch2 = ch + sizeof(axis2_char_t);
/* skip spaces */
- while (AXIS2_SPACE == *ch2)
+ while(AXIS2_SPACE == *ch2)
{
ch2 += sizeof(axis2_char_t);
}
@@ -101,16 +98,16 @@
const axutil_env_t * env)
{
- if (!http_header)
+ if(!http_header)
{
return;
}
- if (http_header->name)
+ if(http_header->name)
{
AXIS2_FREE(env->allocator, http_header->name);
}
- if (http_header->value)
+ if(http_header->value)
{
AXIS2_FREE(env->allocator, http_header->value);
}
@@ -129,11 +126,9 @@
AXIS2_PARAM_CHECK(env->error, http_header, NULL);
- len = axutil_strlen(http_header->name) +
- axutil_strlen(http_header->value) + 8;
- external_form = (axis2_char_t *) AXIS2_MALLOC(env->allocator, len);
- sprintf(external_form, "%s: %s%s", http_header->name,
- http_header->value, AXIS2_HTTP_CRLF);
+ len = axutil_strlen(http_header->name) + axutil_strlen(http_header->value) + 8;
+ external_form = (axis2_char_t *)AXIS2_MALLOC(env->allocator, len);
+ sprintf(external_form, "%s: %s%s", http_header->name, http_header->value, AXIS2_HTTP_CRLF);
return external_form;
}
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=805347&r1=805346&r2=805347&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 Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -33,8 +32,7 @@
{
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);
+ return axis2_http_out_transport_info_set_content_type(http_transport_info, env, content_type);
}
axis2_status_t AXIS2_CALL
@@ -45,8 +43,7 @@
{
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);
+ return axis2_http_out_transport_info_set_char_encoding(http_transport_info, env, encoding);
}
void AXIS2_CALL
@@ -62,10 +59,7 @@
static const axis2_out_transport_info_ops_t ops_var = {
axis2_out_transport_info_impl_set_content_type,
- axis2_out_transport_info_impl_set_char_encoding,
- axis2_out_transport_info_impl_free
-};
-
+ axis2_out_transport_info_impl_set_char_encoding, axis2_out_transport_info_impl_free };
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_http_out_transport_info_impl_set_content_type(
@@ -77,53 +71,38 @@
axis2_char_t *tmp2 = NULL;
AXIS2_PARAM_CHECK(env->error, content_type, AXIS2_FAILURE);
- if (http_out_transport_info->encoding)
+ if(http_out_transport_info->encoding)
{
- axis2_char_t *charset_pos = axutil_strcasestr(content_type,
- AXIS2_CHARSET);
- if (!charset_pos)
+ axis2_char_t *charset_pos = axutil_strcasestr(content_type, AXIS2_CHARSET);
+ if(!charset_pos)
{
/* if "charset" not found in content_type string */
- tmp1 = axutil_stracat(env, content_type,
- AXIS2_CONTENT_TYPE_CHARSET);
+ 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_simple_response_set_header(http_out_transport_info-> response, env,
+ 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_simple_response_set_header(http_out_transport_info-> response, env,
+ 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)
+ 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_simple_response_set_header(http_out_transport_info-> response, env,
+ 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,
@@ -131,7 +110,7 @@
const axis2_char_t * encoding)
{
AXIS2_PARAM_CHECK(env->error, encoding, AXIS2_FAILURE);
- if (http_out_transport_info->encoding)
+ if(http_out_transport_info->encoding)
{
AXIS2_FREE(env->allocator, http_out_transport_info->encoding);
}
@@ -139,23 +118,22 @@
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)
{
- if (!http_out_transport_info)
+ if(!http_out_transport_info)
{
return;
}
- if (http_out_transport_info->response)
+ if(http_out_transport_info->response)
{
axis2_http_simple_response_free(http_out_transport_info->response, env);
}
- if (http_out_transport_info->encoding)
+ if(http_out_transport_info->encoding)
{
AXIS2_FREE(env->allocator, http_out_transport_info->encoding);
}
@@ -163,7 +141,6 @@
return;
}
-
AXIS2_EXTERN axis2_http_out_transport_info_t *AXIS2_CALL
axis2_http_out_transport_info_create(
const axutil_env_t * env,
@@ -171,16 +148,15 @@
{
axis2_http_out_transport_info_t *http_out_transport_info = NULL;
- http_out_transport_info = (axis2_http_out_transport_info_t *) AXIS2_MALLOC
- (env->allocator, sizeof(axis2_http_out_transport_info_t));
+ 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)
+ if(!http_out_transport_info)
{
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));
+ 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;
@@ -188,12 +164,10 @@
http_out_transport_info->set_content_type = NULL;
http_out_transport_info->free_function = NULL;
- http_out_transport_info->set_char_encoding =
- axis2_http_out_transport_info_impl_set_char_encoding;
- http_out_transport_info->set_content_type =
- axis2_http_out_transport_info_impl_set_content_type;
- http_out_transport_info->free_function =
- axis2_http_out_transport_info_impl_free;
+ http_out_transport_info->set_char_encoding
+ = axis2_http_out_transport_info_impl_set_char_encoding;
+ http_out_transport_info->set_content_type = axis2_http_out_transport_info_impl_set_content_type;
+ http_out_transport_info->free_function = axis2_http_out_transport_info_impl_free;
return http_out_transport_info;
}
@@ -225,8 +199,7 @@
const axutil_env_t * env,
const axis2_char_t * content_type)
{
- return http_out_transport_info->set_content_type(http_out_transport_info,
- env, content_type);
+ return http_out_transport_info->set_content_type(http_out_transport_info, env, content_type);
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -235,46 +208,40 @@
const axutil_env_t * env,
const axis2_char_t * encoding)
{
- return http_out_transport_info->set_char_encoding(http_out_transport_info,
- env, encoding);
+ return http_out_transport_info->set_char_encoding(http_out_transport_info, 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,
const axutil_env_t * env,
axis2_status_t(AXIS2_CALL * set_char_encoding)
(axis2_http_out_transport_info_t *,
- const axutil_env_t *,
- const axis2_char_t *))
+ const axutil_env_t *,
+ const axis2_char_t *))
{
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,
const axutil_env_t * env,
axis2_status_t(AXIS2_CALL *
- set_content_type) (axis2_http_out_transport_info_t *,
- const axutil_env_t *,
- const axis2_char_t *))
+ set_content_type) (axis2_http_out_transport_info_t *,
+ const axutil_env_t *,
+ const axis2_char_t *))
{
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,
const axutil_env_t * env,
void (AXIS2_CALL * free_function) (axis2_http_out_transport_info_t *,
- const axutil_env_t *))
+ const axutil_env_t *))
{
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=805347&r1=805346&r2=805347&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 Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -42,19 +41,18 @@
AXIS2_PARAM_CHECK(env->error, uri, NULL);
AXIS2_PARAM_CHECK(env->error, http_version, NULL);
- request_line = (axis2_http_request_line_t *) AXIS2_MALLOC
- (env->allocator, sizeof(axis2_http_request_line_t));
+ request_line = (axis2_http_request_line_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_http_request_line_t));
- if (!request_line)
+ if(!request_line)
{
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 =
- (axis2_char_t *) axutil_strdup(env, http_version);
+ 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 = (axis2_char_t *)axutil_strdup(env, http_version);
return request_line;
}
@@ -65,20 +63,20 @@
const axutil_env_t * env)
{
- if (!request_line)
+ if(!request_line)
{
return;
}
- if (request_line->method)
+ if(request_line->method)
{
AXIS2_FREE(env->allocator, request_line->method);
}
- if (request_line->uri)
+ if(request_line->uri)
{
AXIS2_FREE(env->allocator, request_line->uri);
}
- if (request_line->http_version)
+ if(request_line->http_version)
{
AXIS2_FREE(env->allocator, request_line->http_version);
}
@@ -87,7 +85,6 @@
return;
}
-
AXIS2_EXTERN axis2_http_request_line_t *AXIS2_CALL
axis2_http_request_line_parse_line(
const axutil_env_t * env,
@@ -105,18 +102,16 @@
tmp = axutil_strstr(str, AXIS2_HTTP_CRLF);
- if (!tmp)
+ if(!tmp)
{
- AXIS2_HANDLE_ERROR(env,
- 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)
+ if(!req_line)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
@@ -127,23 +122,19 @@
method = tmp;
tmp = strchr(tmp, AXIS2_SPACE);
- if (!tmp)
+ if(!tmp)
{
AXIS2_FREE(env->allocator, req_line);
- AXIS2_HANDLE_ERROR(env,
- 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++ = AXIS2_ESC_NULL;
uri = tmp;
tmp = strrchr(tmp, AXIS2_SPACE);
- if (!tmp)
+ if(!tmp)
{
AXIS2_FREE(env->allocator, req_line);
- AXIS2_HANDLE_ERROR(env,
- 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++ = AXIS2_ESC_NULL;
@@ -186,27 +177,26 @@
int alloc_len = 0;
axis2_char_t *ret = NULL;
- alloc_len = axutil_strlen(request_line->method) +
- axutil_strlen(request_line->uri) +
- axutil_strlen(request_line->http_version) + 6;
+ alloc_len = axutil_strlen(request_line->method) + axutil_strlen(request_line->uri)
+ + axutil_strlen(request_line->http_version) + 6;
/* 5 = 2 * spaces + '/' +CR + LF + '\0' */
ret = AXIS2_MALLOC(env->allocator, alloc_len * sizeof(axis2_char_t));
- if (!ret)
+ if(!ret)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- if (request_line->uri[0] != AXIS2_F_SLASH)
+ 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);
+ request_line->http_version, AXIS2_HTTP_CRLF);
}
else
{
sprintf(ret, "%s %s %s%s", request_line->method, request_line->uri,
- request_line->http_version, AXIS2_HTTP_CRLF);
+ request_line->http_version, AXIS2_HTTP_CRLF);
}
return ret;
}
Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_response_writer.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_response_writer.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_response_writer.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_response_writer.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -33,7 +32,7 @@
axutil_stream_t * stream)
{
return axis2_http_response_writer_create_with_encoding(env, stream,
- AXIS2_HTTP_DEFAULT_CONTENT_CHARSET);
+ AXIS2_HTTP_DEFAULT_CONTENT_CHARSET);
}
@@ -47,17 +46,17 @@
AXIS2_PARAM_CHECK(env->error, encoding, NULL);
- response_writer = (axis2_http_response_writer_t *) AXIS2_MALLOC
- (env->allocator, sizeof(axis2_http_response_writer_t));
+ response_writer = (axis2_http_response_writer_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_http_response_writer_t));
- if (!response_writer)
+ if(!response_writer)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- memset ((void *)response_writer, 0, sizeof (axis2_http_response_writer_t));
+ memset((void *)response_writer, 0, sizeof(axis2_http_response_writer_t));
response_writer->stream = stream;
- response_writer->encoding = (axis2_char_t *) axutil_strdup(env, encoding);
+ response_writer->encoding = (axis2_char_t *)axutil_strdup(env, encoding);
return response_writer;
}
@@ -67,7 +66,7 @@
axis2_http_response_writer_t * response_writer,
const axutil_env_t * env)
{
- if (!response_writer)
+ if(!response_writer)
{
return;
}
@@ -95,12 +94,12 @@
int write = -1;
AXIS2_PARAM_CHECK(env->error, response_writer, AXIS2_FAILURE);
- if (!response_writer->stream)
+ if(!response_writer->stream)
{
return AXIS2_FAILURE;
}
write = axutil_stream_write(response_writer->stream, env, &c, 1);
- if (write < 0)
+ if(write < 0)
{
return AXIS2_FAILURE;
}
@@ -120,12 +119,12 @@
AXIS2_PARAM_CHECK(env->error, response_writer, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, buf, AXIS2_FAILURE);
- if (!response_writer->stream)
+ if(!response_writer->stream)
{
return AXIS2_FAILURE;
}
write = axutil_stream_write(response_writer->stream, env, buf, len);
- if (write < 0)
+ if(write < 0)
{
return AXIS2_FAILURE;
}
@@ -145,15 +144,16 @@
AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
len = axutil_strlen(str);
- if (!response_writer->stream)
+ if(!response_writer->stream)
{
return AXIS2_FAILURE;
}
write = axutil_stream_write(response_writer->stream, env, str, len);
- if (write < 0)
+ if(write < 0)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "failed to write to stream\
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "failed to write to stream\
string %s of length %d", str, len);
return AXIS2_FAILURE;
}
@@ -180,11 +180,9 @@
{
AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
- if (AXIS2_SUCCESS == axis2_http_response_writer_print_str(response_writer,
- env, str))
+ if(AXIS2_SUCCESS == axis2_http_response_writer_print_str(response_writer, env, str))
{
- return axis2_http_response_writer_print_str(response_writer, env,
- AXIS2_HTTP_CRLF);
+ return axis2_http_response_writer_print_str(response_writer, env, AXIS2_HTTP_CRLF);
}
return AXIS2_FAILURE;
}
@@ -194,6 +192,5 @@
axis2_http_response_writer_t * response_writer,
const axutil_env_t * env)
{
- return axis2_http_response_writer_print_str(response_writer, env,
- AXIS2_HTTP_CRLF);
+ return axis2_http_response_writer_print_str(response_writer, env, AXIS2_HTTP_CRLF);
}
Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_request.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_request.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_request.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_request.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -41,44 +40,41 @@
{
axis2_http_simple_request_t *simple_request = NULL;
- simple_request = (axis2_http_simple_request_t *) AXIS2_MALLOC
- (env->allocator, sizeof(axis2_http_simple_request_t));
+ simple_request = (axis2_http_simple_request_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_http_simple_request_t));
- if (!simple_request)
+ if(!simple_request)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- memset ((void *)simple_request, 0, sizeof (axis2_http_simple_request_t));
+ memset((void *)simple_request, 0, sizeof(axis2_http_simple_request_t));
simple_request->request_line = request_line;
simple_request->stream = content;
simple_request->header_group = NULL;
simple_request->owns_stream = AXIS2_FALSE;
- if (!(simple_request->stream))
+ if(!(simple_request->stream))
{
simple_request->stream = axutil_stream_create_basic(env);
- if (!simple_request->stream)
+ if(!simple_request->stream)
{
- axis2_http_simple_request_free((axis2_http_simple_request_t *)
- simple_request, env);
+ axis2_http_simple_request_free((axis2_http_simple_request_t *)simple_request, env);
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
simple_request->owns_stream = AXIS2_TRUE;
}
- if ((http_hdr_count > 0) && http_headers)
+ if((http_hdr_count > 0) && http_headers)
{
int i = 0;
- simple_request->header_group = axutil_array_list_create(env,
- http_hdr_count);
+ simple_request->header_group = axutil_array_list_create(env, http_hdr_count);
- for (i = 0; i < (int)http_hdr_count; i++)
- /* We are sure that the difference lies within the int range */
+ for(i = 0; i < (int)http_hdr_count; i++)
+ /* We are sure that the difference lies within the int range */
{
- axutil_array_list_add(simple_request->header_group, env,
- (void *) http_headers[i]);
+ axutil_array_list_add(simple_request->header_group, env, (void *)http_headers[i]);
}
}
@@ -90,35 +86,32 @@
axis2_http_simple_request_t * simple_request,
const axutil_env_t * env)
{
- if (!simple_request)
+ if(!simple_request)
{
return;
}
- if (AXIS2_TRUE == simple_request->owns_stream)
+ if(AXIS2_TRUE == simple_request->owns_stream)
{
axutil_stream_free(simple_request->stream, env);
}
/*
- Don't free the stream since it belongs to the socket
+ Don't free the stream since it belongs to the socket
*/
- if (simple_request->request_line)
+ if(simple_request->request_line)
{
axis2_http_request_line_free(simple_request->request_line, env);
}
- if (simple_request->header_group)
+ if(simple_request->header_group)
{
int i = 0;
axis2_http_header_t *tmp = NULL;
- for (i = 0; i < axutil_array_list_size(simple_request->header_group,
- env); i++)
+ for(i = 0; i < axutil_array_list_size(simple_request->header_group, env); i++)
{
- tmp =
- (axis2_http_header_t *) axutil_array_list_get(simple_request->
- header_group, env,
- i);
+ tmp = (axis2_http_header_t *)axutil_array_list_get(simple_request-> header_group, env,
+ i);
axis2_http_header_free(tmp, env);
}
@@ -129,7 +122,6 @@
return;
}
-
AXIS2_EXTERN axis2_http_request_line_t *AXIS2_CALL
axis2_http_simple_request_get_request_line(
const axis2_http_simple_request_t * simple_request,
@@ -138,7 +130,6 @@
return simple_request->request_line;
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_http_simple_request_set_request_line(
axis2_http_simple_request_t * simple_request,
@@ -150,7 +141,6 @@
return AXIS2_SUCCESS;
}
-
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axis2_http_simple_request_contains_header(
axis2_http_simple_request_t * simple_request,
@@ -163,29 +153,29 @@
AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
- if (!simple_request->header_group)
+ if(!simple_request->header_group)
{
- AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI, "http simple request \
+ AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI,
+ "http simple request \
does not contain headers, unable to find: %s header", name);
return AXIS2_FALSE;
}
count = axutil_array_list_size(simple_request->header_group, env);
- if (0 == count)
+ if(0 == count)
{
- AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI, "http simple request \
+ AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI,
+ "http simple request \
contains zero headers, unable to find: %s header", name);
return AXIS2_FALSE;
}
- for (i = 0; i < count; i++)
+ for(i = 0; i < count; i++)
{
- header_name = axis2_http_header_get_name((axis2_http_header_t *)
- axutil_array_list_get
- (simple_request->header_group,
- env, i), env);
- if (0 == axutil_strcasecmp(name, header_name))
+ header_name = axis2_http_header_get_name((axis2_http_header_t *)axutil_array_list_get(
+ simple_request->header_group, env, i), env);
+ if(0 == axutil_strcasecmp(name, header_name))
{
return AXIS2_TRUE;
}
@@ -193,7 +183,6 @@
return AXIS2_FALSE;
}
-
AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
axis2_http_simple_request_get_headers(
const axis2_http_simple_request_t * simple_request,
@@ -202,7 +191,6 @@
return simple_request->header_group;
}
-
AXIS2_EXTERN axis2_http_header_t *AXIS2_CALL
axis2_http_simple_request_get_first_header(
const axis2_http_simple_request_t * simple_request,
@@ -218,28 +206,29 @@
AXIS2_PARAM_CHECK(env->error, str, NULL);
header_group = simple_request->header_group;
- if (!simple_request->header_group)
+ if(!simple_request->header_group)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "http simple request \
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "http simple request \
does not contain headers, unable to find: %s header", str);
return NULL;
}
- if (0 == axutil_array_list_size(header_group, env))
+ if(0 == axutil_array_list_size(header_group, env))
{
- AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI, "http simple request \
+ AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI,
+ "http simple request \
contain zero headers, unable to find: %s header", str);
return NULL;
}
count = axutil_array_list_size(header_group, env);
- for (i = 0; i < count; i++)
+ for(i = 0; i < count; i++)
{
- tmp_header = (axis2_http_header_t *) axutil_array_list_get(header_group,
- env, i);
+ tmp_header = (axis2_http_header_t *)axutil_array_list_get(header_group, env, i);
tmp_name = axis2_http_header_get_name(tmp_header, env);
- if (0 == axutil_strcasecmp(str, tmp_name))
+ if(0 == axutil_strcasecmp(str, tmp_name))
{
return tmp_header;
}
@@ -247,7 +236,6 @@
return NULL;
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_http_simple_request_remove_headers(
axis2_http_simple_request_t * simple_request,
@@ -264,7 +252,7 @@
header_group = simple_request->header_group;
- if (!header_group)
+ if(!header_group)
{
/* Even though we couldn't complete the op, we are sure that the
* requred header is no more in the request. So we can proceed without a
@@ -275,12 +263,11 @@
count = axutil_array_list_size(header_group, env);
- for (i = 0; i < count; i++)
+ for(i = 0; i < count; i++)
{
- tmp_header = (axis2_http_header_t *) axutil_array_list_get(header_group,
- env, i);
+ tmp_header = (axis2_http_header_t *)axutil_array_list_get(header_group, env, i);
tmp_name = axis2_http_header_get_name(tmp_header, env);
- if (0 == axutil_strcasecmp(str, tmp_name))
+ if(0 == axutil_strcasecmp(str, tmp_name))
{
axis2_http_header_free(tmp_header, env);
axutil_array_list_remove(header_group, env, i);
@@ -290,7 +277,6 @@
return AXIS2_SUCCESS;
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_http_simple_request_add_header(
axis2_http_simple_request_t * simple_request,
@@ -299,14 +285,13 @@
{
AXIS2_PARAM_CHECK(env->error, header, AXIS2_FAILURE);
- if (!simple_request->header_group)
+ if(!simple_request->header_group)
{
simple_request->header_group = axutil_array_list_create(env, 1);
}
return axutil_array_list_add(simple_request->header_group, env, header);
}
-
AXIS2_EXTERN const axis2_char_t *AXIS2_CALL
axis2_http_simple_request_get_content_type(
const axis2_http_simple_request_t * simple_request,
@@ -314,9 +299,9 @@
{
axis2_http_header_t *tmp_header = NULL;
- tmp_header = axis2_http_simple_request_get_first_header
- (simple_request, env, AXIS2_HTTP_HEADER_CONTENT_TYPE);
- if (tmp_header)
+ tmp_header = axis2_http_simple_request_get_first_header(simple_request, env,
+ AXIS2_HTTP_HEADER_CONTENT_TYPE);
+ if(tmp_header)
{
return axis2_http_header_get_value(tmp_header, env);
}
@@ -324,7 +309,6 @@
return AXIS2_HTTP_HEADER_ACCEPT_TEXT_PLAIN;
}
-
AXIS2_EXTERN const axis2_char_t *AXIS2_CALL
axis2_http_simple_request_get_charset(
const axis2_http_simple_request_t * simple_request,
@@ -332,17 +316,16 @@
{
axis2_http_header_t *tmp_header = NULL;
- tmp_header = axis2_http_simple_request_get_first_header
- (simple_request, env, AXIS2_HTTP_HEADER_CONTENT_TYPE);
- if (tmp_header)
+ tmp_header = axis2_http_simple_request_get_first_header(simple_request, env,
+ AXIS2_HTTP_HEADER_CONTENT_TYPE);
+ if(tmp_header)
{
axis2_char_t *value = axis2_http_header_get_value(tmp_header, env);
- axis2_char_t *charset = (axis2_char_t *) strstr((char *) value,
- (char *)
- AXIS2_HTTP_CHAR_SET_ENCODING);
- if (charset)
+ axis2_char_t *charset = (axis2_char_t *)strstr((char *)value,
+ (char *)AXIS2_HTTP_CHAR_SET_ENCODING);
+ if(charset)
{
- charset = strchr((char *) charset, AXIS2_EQ);
+ charset = strchr((char *)charset, AXIS2_EQ);
return charset;
}
}
@@ -350,7 +333,6 @@
return AXIS2_HTTP_DEFAULT_CONTENT_CHARSET;
}
-
AXIS2_EXTERN axis2_ssize_t AXIS2_CALL
axis2_http_simple_request_get_content_length(
const axis2_http_simple_request_t * simple_request,
@@ -359,9 +341,9 @@
axis2_http_header_t *tmp_header = NULL;
int error_return = -1;
- tmp_header = axis2_http_simple_request_get_first_header
- (simple_request, env, AXIS2_HTTP_HEADER_CONTENT_LENGTH);
- if (tmp_header)
+ tmp_header = axis2_http_simple_request_get_first_header(simple_request, env,
+ AXIS2_HTTP_HEADER_CONTENT_LENGTH);
+ if(tmp_header)
{
return AXIS2_ATOI(axis2_http_header_get_value(tmp_header, env));
}
@@ -376,7 +358,6 @@
return simple_request->stream;
}
-
AXIS2_EXTERN axis2_ssize_t AXIS2_CALL
axis2_http_simple_request_get_body_bytes(
const axis2_http_simple_request_t * simple_request,
@@ -391,26 +372,26 @@
int read_len = 0;
body = simple_request->stream;
- if (!body)
+ if(!body)
{
- *buf = (char *) AXIS2_MALLOC(env->allocator, 1);
+ *buf = (char *)AXIS2_MALLOC(env->allocator, 1);
*buf[0] = '\0';
return 0;
}
length = axis2_http_simple_request_get_content_length(simple_request, env);
- if (length > 0)
+ if(length > 0)
{
- *buf = (char *) AXIS2_MALLOC(env->allocator, length + 1);
+ *buf = (char *)AXIS2_MALLOC(env->allocator, length + 1);
read_len = axutil_stream_read(body, env, *buf, length + 1);
return read_len;
}
tmp_buf2 = AXIS2_MALLOC(env->allocator, 128 * sizeof(char));
- while (axutil_stream_read(body, env, tmp_buf2, 128) > 0)
+ while(axutil_stream_read(body, env, tmp_buf2, 128) > 0)
{
tmp_buf3 = axutil_stracat(env, tmp_buf, tmp_buf2);
- if (tmp_buf)
+ if(tmp_buf)
{
AXIS2_FREE(env->allocator, tmp_buf);
tmp_buf = NULL;
@@ -419,24 +400,23 @@
}
- if(tmp_buf2)
- {
- AXIS2_FREE(env->allocator, tmp_buf2);
- tmp_buf2 = NULL;
- }
+ if(tmp_buf2)
+ {
+ AXIS2_FREE(env->allocator, tmp_buf2);
+ tmp_buf2 = NULL;
+ }
- if (tmp_buf)
+ if(tmp_buf)
{
*buf = tmp_buf;
return axutil_strlen(tmp_buf);
}
- *buf = (char *) AXIS2_MALLOC(env->allocator, 1);
+ *buf = (char *)AXIS2_MALLOC(env->allocator, 1);
*buf[0] = AXIS2_ESC_NULL;
return 0;
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_http_simple_request_set_body_string(
axis2_http_simple_request_t * simple_request,
@@ -449,12 +429,13 @@
AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
body_stream = simple_request->stream;
- if (!body_stream)
+ if(!body_stream)
{
body_stream = axutil_stream_create_basic(env);
- if (!body_stream)
+ if(!body_stream)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "unable to create stream\
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "unable to create stream\
for stream %s of %d length", (axis2_char_t *)str, str_len);
return AXIS2_FAILURE;
}
Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_response.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_response.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_response.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_response.c Tue Aug 18 10:15:49 2009
@@ -33,7 +33,6 @@
axis2_char_t *mtom_sending_callback_name;
};
-
AXIS2_EXTERN axis2_http_simple_response_t *AXIS2_CALL
axis2_http_simple_response_create(
const axutil_env_t * env,
@@ -46,32 +45,29 @@
axis2_http_simple_response_t *simple_response = NULL;
ret = axis2_http_simple_response_create_default(env);
- if (!ret)
+ if(!ret)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2 http simple response creation failed");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2 http simple response creation failed");
return NULL;
}
simple_response = ret;
- if (!simple_response)
+ if(!simple_response)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
simple_response->status_line = status_line;
- if (http_hdr_count > 0 && http_headers)
+ if(http_hdr_count > 0 && http_headers)
{
int i = 0;
- simple_response->header_group = axutil_array_list_create(env,
- http_hdr_count);
+ simple_response->header_group = axutil_array_list_create(env, http_hdr_count);
- for (i = 0; i < (int)http_hdr_count; i++)
- /* We are sure that the difference lies within the int range */
+ for(i = 0; i < (int)http_hdr_count; i++)
+ /* We are sure that the difference lies within the int range */
{
- axutil_array_list_add(simple_response->header_group, env,
- (void *) http_headers[i]);
+ axutil_array_list_add(simple_response->header_group, env, (void *)http_headers[i]);
}
}
simple_response->stream = content;
@@ -85,15 +81,15 @@
{
axis2_http_simple_response_t *simple_response = NULL;
- simple_response = (axis2_http_simple_response_t *) AXIS2_MALLOC
- (env->allocator, sizeof(axis2_http_simple_response_t));
+ simple_response = (axis2_http_simple_response_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_http_simple_response_t));
- if (!simple_response)
+ if(!simple_response)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- memset ((void *)simple_response, 0, sizeof(axis2_http_simple_response_t));
+ memset((void *)simple_response, 0, sizeof(axis2_http_simple_response_t));
simple_response->status_line = NULL;
simple_response->header_group = NULL;
simple_response->stream = NULL;
@@ -109,23 +105,20 @@
const axutil_env_t * env)
{
- if (simple_response->status_line)
+ if(simple_response->status_line)
{
axis2_http_status_line_free(simple_response->status_line, env);
}
- if (simple_response->header_group)
+ if(simple_response->header_group)
{
int i = 0;
axis2_http_header_t *tmp = NULL;
- for (i = 0; i < axutil_array_list_size(simple_response->header_group,
- env); i++)
+ for(i = 0; i < axutil_array_list_size(simple_response->header_group, env); i++)
{
- tmp =
- (axis2_http_header_t *) axutil_array_list_get(simple_response->
- header_group, env,
- i);
- if (tmp)
+ tmp = (axis2_http_header_t *)axutil_array_list_get(simple_response-> header_group, env,
+ i);
+ if(tmp)
{
axis2_http_header_free(tmp, env);
}
@@ -133,15 +126,15 @@
axutil_array_list_free(simple_response->header_group, env);
}
- if (simple_response->mime_parts)
+ if(simple_response->mime_parts)
{
int i = 0;
- for (i = 0; i < axutil_array_list_size(simple_response->mime_parts, env); i++)
+ for(i = 0; i < axutil_array_list_size(simple_response->mime_parts, env); i++)
{
axiom_mime_part_t *mime_part = NULL;
- mime_part = (axiom_mime_part_t *)
- axutil_array_list_get(simple_response->mime_parts, env, i);
- if (mime_part)
+ mime_part = (axiom_mime_part_t *)axutil_array_list_get(simple_response->mime_parts,
+ env, i);
+ if(mime_part)
{
axiom_mime_part_free(mime_part, env);
}
@@ -149,7 +142,6 @@
axutil_array_list_free(simple_response->mime_parts, env);
}
-
AXIS2_FREE(env->allocator, simple_response);
/*
* Stream is not freed
@@ -172,32 +164,28 @@
AXIS2_PARAM_CHECK(env->error, status_code, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, phrase, AXIS2_FAILURE);
- tmp_status_line_str = AXIS2_MALLOC(env->allocator,
- (axutil_strlen(http_ver) +
- axutil_strlen(phrase) +
- 8) * sizeof(axis2_char_t *));
+ tmp_status_line_str = AXIS2_MALLOC(env->allocator, (axutil_strlen(http_ver) + axutil_strlen(
+ phrase) + 8) * sizeof(axis2_char_t *));
- if (!tmp_status_line_str)
+ if(!tmp_status_line_str)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
}
- sprintf(tmp_status_line_str, "%s %3d %s%s", http_ver, status_code, phrase,
- AXIS2_HTTP_CRLF);
+ sprintf(tmp_status_line_str, "%s %3d %s%s", http_ver, status_code, phrase, AXIS2_HTTP_CRLF);
- if (simple_response->status_line)
+ if(simple_response->status_line)
{
axis2_http_status_line_free(simple_response->status_line, env);
simple_response->status_line = NULL;
}
- simple_response->status_line = axis2_http_status_line_create(env,
- tmp_status_line_str);
+ simple_response->status_line = axis2_http_status_line_create(env, tmp_status_line_str);
AXIS2_FREE(env->allocator, tmp_status_line_str);
- if (!simple_response->status_line)
+ if(!simple_response->status_line)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2 http status line creation failed for tmp \
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "axis2 http status line creation failed for tmp \
string %s", tmp_status_line_str);
return AXIS2_FAILURE;
}
@@ -209,15 +197,14 @@
axis2_http_simple_response_t * simple_response,
const axutil_env_t * env)
{
- if (!(simple_response->status_line))
+ if(!(simple_response->status_line))
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2 simple response , status line is not available");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "axis2 simple response , status line is not available");
return NULL;
}
- return axis2_http_status_line_get_reason_phrase(simple_response->
- status_line, env);
+ return axis2_http_status_line_get_reason_phrase(simple_response-> status_line, env);
}
int AXIS2_CALL
@@ -225,14 +212,13 @@
axis2_http_simple_response_t * simple_response,
const axutil_env_t * env)
{
- if (!(simple_response->status_line))
+ if(!(simple_response->status_line))
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2 simple response , status line is not available");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "axis2 simple response , status line is not available");
return -1;
}
- return axis2_http_status_line_get_status_code(simple_response->status_line,
- env);
+ return axis2_http_status_line_get_status_code(simple_response->status_line, env);
}
axis2_char_t *AXIS2_CALL
@@ -240,15 +226,14 @@
axis2_http_simple_response_t * simple_response,
const axutil_env_t * env)
{
- if (!(simple_response->status_line))
+ if(!(simple_response->status_line))
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2 simple response , status line is not available");
-
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "axis2 simple response , status line is not available");
+
return NULL;
}
- return axis2_http_status_line_get_http_version(simple_response->status_line,
- env);
+ return axis2_http_status_line_get_http_version(simple_response->status_line, env);
}
axis2_status_t AXIS2_CALL
@@ -257,30 +242,28 @@
const axutil_env_t * env,
axis2_char_t *http_version)
{
- if (!(simple_response->status_line))
+ if(!(simple_response->status_line))
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2 simple response , status line is not available");
-
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "axis2 simple response , status line is not available");
+
return AXIS2_FAILURE;
}
- axis2_http_status_line_set_http_version(simple_response->status_line,
- env, http_version);
+ axis2_http_status_line_set_http_version(simple_response->status_line, env, http_version);
return AXIS2_SUCCESS;
}
-
axis2_char_t *AXIS2_CALL
axis2_http_simple_response_get_status_line(
axis2_http_simple_response_t * simple_response,
const axutil_env_t * env)
{
- if (!(simple_response->status_line))
+ if(!(simple_response->status_line))
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2 simple response , status line is not available");
-
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "axis2 simple response , status line is not available");
+
return NULL;
}
return axis2_http_status_line_to_string(simple_response->status_line, env);
@@ -301,7 +284,7 @@
{
axutil_array_list_t *temp = NULL;
temp = simple_response->header_group;
- if (temp)
+ if(temp)
{
simple_response->header_group = NULL;
}
@@ -323,29 +306,26 @@
AXIS2_PARAM_CHECK(env->error, str, NULL);
header_group = simple_response->header_group;
- if (!simple_response->header_group)
+ if(!simple_response->header_group)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2 simple response , headers not available");
- return NULL;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2 simple response , headers not available");
+ return NULL;
}
- if (0 == axutil_array_list_size(header_group, env))
+ if(0 == axutil_array_list_size(header_group, env))
{
- AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI,
- "axis2 simple response , contains zero headers");
+ AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI, "axis2 simple response , contains zero headers");
return NULL;
}
count = axutil_array_list_size(header_group, env);
- for (i = 0; i < count; i++)
+ for(i = 0; i < count; i++)
{
- tmp_header = (axis2_http_header_t *) axutil_array_list_get(header_group,
- env, i);
+ tmp_header = (axis2_http_header_t *)axutil_array_list_get(header_group, env, i);
tmp_name = axis2_http_header_get_name(tmp_header, env);
- if (0 == axutil_strcasecmp(str, tmp_name))
+ if(0 == axutil_strcasecmp(str, tmp_name))
{
return tmp_header;
}
@@ -369,7 +349,7 @@
AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
header_group = simple_response->header_group;
- if (!header_group)
+ if(!header_group)
{
/* Even though we couldn't complete the op, we are sure that the
* requred header is no more in the request. So we can proceed without a
@@ -380,12 +360,11 @@
count = axutil_array_list_size(header_group, env);
- for (i = 0; i < count; i++)
+ for(i = 0; i < count; i++)
{
- tmp_header = (axis2_http_header_t *) axutil_array_list_get(header_group,
- env, i);
+ tmp_header = (axis2_http_header_t *)axutil_array_list_get(header_group, env, i);
tmp_name = axis2_http_header_get_name(tmp_header, env);
- if (0 == axutil_strcasecmp(str, tmp_name))
+ if(0 == axutil_strcasecmp(str, tmp_name))
{
axis2_http_header_free(tmp_header, env);
axutil_array_list_remove(header_group, env, i);
@@ -409,7 +388,7 @@
AXIS2_PARAM_CHECK(env->error, header, AXIS2_FAILURE);
- if (!simple_response->header_group)
+ if(!simple_response->header_group)
{
simple_response->header_group = axutil_array_list_create(env, 10);
axutil_array_list_add(simple_response->header_group, env, header);
@@ -422,20 +401,18 @@
header_group = simple_response->header_group;
count = axutil_array_list_size(header_group, env);
- for (i = 0; i < count; i++)
+ for(i = 0; i < count; i++)
{
- tmp_header = (axis2_http_header_t *) axutil_array_list_get(header_group,
- env, i);
+ tmp_header = (axis2_http_header_t *)axutil_array_list_get(header_group, env, i);
tmp_name = axis2_http_header_get_name(tmp_header, env);
- if (0 == axutil_strcasecmp(axis2_http_header_get_name(header, env),
- tmp_name))
+ if(0 == axutil_strcasecmp(axis2_http_header_get_name(header, env), tmp_name))
{
axis2_http_header_free(tmp_header, env);
axutil_array_list_remove(header_group, env, i);
break;
}
}
- axutil_array_list_add(simple_response->header_group, env, (void *) header);
+ axutil_array_list_add(simple_response->header_group, env, (void *)header);
return AXIS2_SUCCESS;
}
@@ -446,17 +423,16 @@
{
axis2_http_header_t *tmp_header = NULL;
- tmp_header = axis2_http_simple_response_get_first_header
- (simple_response, env, AXIS2_HTTP_HEADER_CONTENT_TYPE);
- if (tmp_header)
+ tmp_header = axis2_http_simple_response_get_first_header(simple_response, env,
+ AXIS2_HTTP_HEADER_CONTENT_TYPE);
+ if(tmp_header)
{
axis2_char_t *value = axis2_http_header_get_value(tmp_header, env);
- axis2_char_t *charset = (axis2_char_t *) strstr((char *) value,
- (char *)
- AXIS2_HTTP_CHAR_SET_ENCODING);
- if (charset)
+ axis2_char_t *charset = (axis2_char_t *)strstr((char *)value,
+ (char *)AXIS2_HTTP_CHAR_SET_ENCODING);
+ if(charset)
{
- charset = strchr((char *) charset, AXIS2_EQ);
+ charset = strchr((char *)charset, AXIS2_EQ);
return charset;
}
}
@@ -472,9 +448,9 @@
axis2_http_header_t *tmp_header = NULL;
int error_return = -1;
- tmp_header = axis2_http_simple_response_get_first_header
- (simple_response, env, AXIS2_HTTP_HEADER_CONTENT_LENGTH);
- if (tmp_header)
+ tmp_header = axis2_http_simple_response_get_first_header(simple_response, env,
+ AXIS2_HTTP_HEADER_CONTENT_LENGTH);
+ if(tmp_header)
{
return AXIS2_ATOI(axis2_http_header_get_value(tmp_header, env));
}
@@ -488,9 +464,9 @@
{
axis2_http_header_t *tmp_header = NULL;
- tmp_header = axis2_http_simple_response_get_first_header
- (simple_response, env, AXIS2_HTTP_HEADER_CONTENT_TYPE);
- if (tmp_header)
+ tmp_header = axis2_http_simple_response_get_first_header(simple_response, env,
+ AXIS2_HTTP_HEADER_CONTENT_TYPE);
+ if(tmp_header)
{
return axis2_http_header_get_value(tmp_header, env);
}
@@ -509,13 +485,13 @@
AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
body_stream = simple_response->stream;
- if (!body_stream)
+ if(!body_stream)
{
body_stream = axutil_stream_create_basic(env);
- if (!body_stream)
+ if(!body_stream)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "unable to create basic stream for string %s", str);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "unable to create basic stream for string %s",
+ str);
return AXIS2_FAILURE;
}
simple_response->stream = body_stream;
@@ -557,46 +533,43 @@
axis2_bool_t loop_state = AXIS2_TRUE;
int return_size = -1;
- if (!simple_response->stream)
+ if(!simple_response->stream)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NULL_BODY, AXIS2_FAILURE);
return return_size;
}
tmp_stream = axutil_stream_create_basic(env);
- while (loop_state)
+ while(loop_state)
{
int read = 0;
int write = 0;
char buf[AXIS2_HTTP_SIMPLE_RESPONSE_READ_SIZE];
- read =
- axutil_stream_read(simple_response->stream, env, buf,
- AXIS2_HTTP_SIMPLE_RESPONSE_READ_SIZE);
- if (read < 0)
+ read = axutil_stream_read(simple_response->stream, env, buf,
+ AXIS2_HTTP_SIMPLE_RESPONSE_READ_SIZE);
+ if(read < 0)
{
break;
}
write = axutil_stream_write(tmp_stream, env, buf, read);
- if (read < (AXIS2_HTTP_SIMPLE_RESPONSE_READ_SIZE - 1))
+ if(read < (AXIS2_HTTP_SIMPLE_RESPONSE_READ_SIZE - 1))
{
break;
}
}
return_size = axutil_stream_get_len(tmp_stream, env);
- if (return_size > 0)
+ if(return_size > 0)
{
- *buffer = (char *) AXIS2_MALLOC(env->allocator, sizeof(char) *
- (return_size + 1));
+ *buffer = (char *)AXIS2_MALLOC(env->allocator, sizeof(char) * (return_size + 1));
- if (!buffer)
+ if(!buffer)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return -1;
}
- return_size = axutil_stream_read(tmp_stream, env, *buffer,
- return_size + 1);
+ return_size = axutil_stream_read(tmp_stream, env, *buffer, return_size + 1);
}
axutil_stream_free(tmp_stream, env);
return return_size;
@@ -613,34 +586,29 @@
int i = 0;
AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
- if (!simple_response->header_group)
+ if(!simple_response->header_group)
{
- AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI,
- "axis2 simple response , headers not available");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "axis2 simple response , headers not available");
return AXIS2_FALSE;
}
count = axutil_array_list_size(simple_response->header_group, env);
- if (0 == count)
+ if(0 == count)
{
- AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI,
- "axis2 simple response , contains zero headers");
+ AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI, "axis2 simple response , contains zero headers");
return AXIS2_FALSE;
}
- for (i = 0; i < count; i++)
+ for(i = 0; i < count; i++)
{
- header_name = axis2_http_header_get_name((axis2_http_header_t *)
- axutil_array_list_get
- (simple_response->header_group,
- env, i), env);
- if (0 == axutil_strcasecmp(name, header_name))
+ header_name = axis2_http_header_get_name((axis2_http_header_t *)axutil_array_list_get(
+ simple_response->header_group, env, i), env);
+ if(0 == axutil_strcasecmp(name, header_name))
return AXIS2_TRUE;
}
return AXIS2_FALSE;
}
-
AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
axis2_http_simple_response_get_mime_parts(
axis2_http_simple_response_t * simple_response,
@@ -676,6 +644,6 @@
const axutil_env_t * env,
axis2_char_t *mtom_sending_callback_name)
{
- simple_response->mtom_sending_callback_name =
- mtom_sending_callback_name;
+ simple_response->mtom_sending_callback_name =
+ mtom_sending_callback_name;
}
Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_status_line.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_status_line.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_status_line.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_status_line.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -43,38 +42,33 @@
axis2_char_t *tmp = NULL;
axis2_http_status_line_t *status_line = NULL;
- status_line = (axis2_http_status_line_t *) AXIS2_MALLOC
- (env->allocator, sizeof(axis2_http_status_line_t));
+ status_line = (axis2_http_status_line_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_http_status_line_t));
- if (!status_line)
+ if(!status_line)
{
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- memset ((void *)status_line, 0, sizeof (axis2_http_status_line_t));
- status_line->line = (axis2_char_t *) axutil_strdup(env, str);
+ memset((void *)status_line, 0, sizeof(axis2_http_status_line_t));
+ status_line->line = (axis2_char_t *)axutil_strdup(env, str);
status_line->http_version = NULL;
status_line->reason_phrase = NULL;
status_line->status_code = NULL;
tmp = strstr(str, AXIS2_HTTP_CRLF);
- if (!tmp)
+ if(!tmp)
{
- axis2_http_status_line_free((axis2_http_status_line_t *)
- status_line, env);
- AXIS2_HANDLE_ERROR(env,
- AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
- AXIS2_FAILURE);
+ axis2_http_status_line_free((axis2_http_status_line_t *)status_line, env);
+ 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 */
- tmp_status_line = AXIS2_MALLOC(env->allocator,
- i * sizeof(axis2_char_t) + 1);
- if (!tmp_status_line)
+ tmp_status_line = AXIS2_MALLOC(env->allocator, i * sizeof(axis2_char_t) + 1);
+ if(!tmp_status_line)
{
- axis2_http_status_line_free((axis2_http_status_line_t *)
- status_line, env);
+ axis2_http_status_line_free((axis2_http_status_line_t *)status_line, env);
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -84,43 +78,34 @@
http_version = tmp;
tmp = strchr(tmp, AXIS2_SPACE);
- if (!tmp)
+ if(!tmp)
{
AXIS2_FREE(env->allocator, tmp_status_line);
- axis2_http_status_line_free((axis2_http_status_line_t *)
- status_line, env);
- AXIS2_HANDLE_ERROR(env,
- AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
- AXIS2_FAILURE);
+ axis2_http_status_line_free((axis2_http_status_line_t *)status_line, env);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE, AXIS2_FAILURE);
return NULL;
}
*tmp++ = AXIS2_ESC_NULL;
status_code = tmp;
tmp = strchr(tmp, AXIS2_SPACE);
- if (!tmp)
+ if(!tmp)
{
AXIS2_FREE(env->allocator, tmp_status_line);
- axis2_http_status_line_free((axis2_http_status_line_t *)
- status_line, env);
- AXIS2_HANDLE_ERROR(env,
- AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE,
- AXIS2_FAILURE);
+ axis2_http_status_line_free((axis2_http_status_line_t *)status_line, env);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_INVALID_HTTP_HEADER_START_LINE, AXIS2_FAILURE);
return NULL;
}
*tmp++ = AXIS2_ESC_NULL;
reason_phrase = tmp;
- status_line->http_version = (axis2_char_t *)
- axutil_strdup(env, http_version);
- status_line->status_code = (axis2_char_t *) axutil_strdup(env, status_code);
- status_line->reason_phrase = (axis2_char_t *)
- axutil_strdup(env, reason_phrase);
+ status_line->http_version = (axis2_char_t *)axutil_strdup(env, http_version);
+ status_line->status_code = (axis2_char_t *)axutil_strdup(env, status_code);
+ status_line->reason_phrase = (axis2_char_t *)axutil_strdup(env, reason_phrase);
- if (!status_line->http_version || !status_line->reason_phrase)
+ if(!status_line->http_version || !status_line->reason_phrase)
{
AXIS2_FREE(env->allocator, tmp_status_line);
- axis2_http_status_line_free((axis2_http_status_line_t *)
- status_line, env);
+ axis2_http_status_line_free((axis2_http_status_line_t *)status_line, env);
AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -135,24 +120,24 @@
const axutil_env_t * env)
{
- if (!status_line)
+ if(!status_line)
{
return;
}
- if (status_line->line)
+ if(status_line->line)
{
AXIS2_FREE(env->allocator, status_line->line);
}
- if (status_line->http_version)
+ if(status_line->http_version)
{
AXIS2_FREE(env->allocator, status_line->http_version);
}
- if (status_line->status_code)
+ if(status_line->status_code)
{
AXIS2_FREE(env->allocator, status_line->status_code);
}
- if (status_line->reason_phrase)
+ if(status_line->reason_phrase)
{
AXIS2_FREE(env->allocator, status_line->reason_phrase);
}
@@ -166,7 +151,7 @@
const axis2_http_status_line_t * status_line,
const axutil_env_t * env)
{
- if (status_line->status_code)
+ if(status_line->status_code)
{
return AXIS2_ATOI(status_line->status_code);
}
@@ -177,7 +162,6 @@
}
-
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axis2_http_status_line_get_http_version(
const axis2_http_status_line_t * status_line,
@@ -198,7 +182,7 @@
status_line->http_version = NULL;
}
- status_line->http_version = (axis2_char_t *) axutil_strdup(env, http_version);
+ status_line->http_version = (axis2_char_t *)axutil_strdup(env, http_version);
}
@@ -210,13 +194,12 @@
return status_line->reason_phrase;
}
-
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axis2_http_status_line_starts_with_http(
axis2_http_status_line_t * status_line,
const axutil_env_t * env)
{
- if (0 == axutil_strncasecmp(status_line->line, AXIS2_HTTP, 4))
+ if(0 == axutil_strncasecmp(status_line->line, AXIS2_HTTP, 4))
{
return AXIS2_TRUE;
}