Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.6.0
-
None
-
all environments
Description
There are two functions in apache2_out_transport_info.c to set the charSet ant ContentType of the response message: axis2_apache_out_transport_info_set_content_type & axis2_apache_out_transport_info_set_char_encoding.
When you use axis2_apache_out_transport_info_set_char_encoding to set the charSet, this function don't converts the input parameter axis2_http_out_transport_info_t * info to axis2_apache2_out_transport_info_t*, so the encoding is seted to the axis2_http_out_transport_info struct. But whe you use axis2_apache_out_transport_info_set_content_type to set the ContentType, this function converts the input parameter axis2_http_out_transport_info_t * out_transport_info to axis2_apache2_out_transport_info_t*, so this function use axis2_apache2_out_transport_info struct to get encoding, you know the encoding field in this struct is null, so we can't get the correct encoding in the response message.
the two functions are:
axis2_status_t AXIS2_CALL
axis2_apache_out_transport_info_set_char_encoding(
axis2_http_out_transport_info_t * 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 (info->encoding)
{ AXIS2_FREE(env->allocator, info->encoding); }info->encoding = axutil_strdup(env, encoding);
return AXIS2_SUCCESS;
}
axis2_status_t AXIS2_CALL
axis2_apache_out_transport_info_set_content_type(
axis2_http_out_transport_info_t * out_transport_info,
const axutil_env_t * env,
const axis2_char_t * content_type)
{
axis2_apache2_out_transport_info_t *info = NULL;
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);
info = AXIS2_INTF_TO_IMPL(out_transport_info);
if (info->encoding)
{ tmp1 = axutil_stracat(env, content_type, ";charset="); tmp2 = axutil_stracat(env, tmp1, info->encoding); info->request->content_type = apr_pstrdup(info->request->pool, tmp2); AXIS2_FREE(env->allocator, tmp1); AXIS2_FREE(env->allocator, tmp2); }else
{ info->request->content_type = apr_pstrdup(info->request->pool, content_type); } return AXIS2_SUCCESS;
}