You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ma...@apache.org on 2008/07/03 17:35:45 UTC
svn commit: r673713 [3/3] - in
/webservices/axis2/branches/c/post_1_4_mtom/c: ./ axiom/include/
axiom/src/attachments/ axiom/src/soap/ ides/vc/axis2c/axis2_http_sender/
ides/vc/axis2c/axis2_http_server/ ides/vc/axis2c/axis2_tcp_receiver/
ides/vc/axis2c...
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/src/core/receivers/msg_recv.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/src/core/receivers/msg_recv.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/src/core/receivers/msg_recv.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/src/core/receivers/msg_recv.c Thu Jul 3 08:35:44 2008
@@ -362,6 +362,11 @@
}
}
axis2_engine_free(engine, env);
+
+ /* Reset the out message context to avoid double freeing at http worker. For example if this is
+ * not done here both in and out message context will try to free the transport out stream
+ * which will result in memeory corruption.
+ */
if (!axis2_msg_ctx_is_paused(out_msg_ctx, env) &&
!axis2_msg_ctx_is_keep_alive(out_msg_ctx, env))
{
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/common/http_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/common/http_worker.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/common/http_worker.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/common/http_worker.c Thu Jul 3 08:35:44 2008
@@ -175,8 +175,7 @@
conf_ctx = http_worker->conf_ctx;
if (!conf_ctx)
{
- AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NULL_CONFIGURATION_CONTEXT,
- AXIS2_FAILURE);
+ AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NULL_CONFIGURATION_CONTEXT, AXIS2_FAILURE);
return AXIS2_FALSE;
}
@@ -472,6 +471,8 @@
/* Here out_stream is set into the in message context. out_stream is copied from in message context
* into the out message context later in core_utils_create_out_msg_ctx() function. The buffer in
* out_stream is finally filled with the soap envelope in http_transport_sender_invoke() function.
+ * To avoid double freeing of out_stream we reset the out message context at the end of engine
+ * receive function.
*/
axis2_msg_ctx_set_transport_out_stream(msg_ctx, env, out_stream);
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/sender/http_transport_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/sender/http_transport_sender.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/sender/http_transport_sender.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/sender/http_transport_sender.c Thu Jul 3 08:35:44 2008
@@ -181,7 +181,6 @@
axis2_bool_t do_mtom;
axutil_property_t *property = NULL;
axiom_node_t *data_out = NULL;
- /*axis2_byte_t *output_stream = NULL;*/
int buffer_size = 0;
axis2_status_t status = AXIS2_SUCCESS;
axis2_conf_ctx_t *conf_ctx = NULL;
@@ -550,9 +549,6 @@
AXIS2_HTTP_OUT_TRANSPORT_INFO_SET_CONTENT_TYPE(out_info,
env,
content_type);
- /*buffer = output_stream;
- axutil_stream_write(out_stream, env, buffer, buffer_size);
- AXIS2_FREE(env->allocator, buffer);*/
}
else
{
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/IIS/axis2_iis_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/IIS/axis2_iis_worker.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/IIS/axis2_iis_worker.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/IIS/axis2_iis_worker.c Thu Jul 3 08:35:44 2008
@@ -51,12 +51,12 @@
axis2_status_t AXIS2_CALL
-start_response(LPEXTENSION_CONTROL_BLOCK lpECB,
- int status,
+start_response(const axutil_env_t * env,
+ LPEXTENSION_CONTROL_BLOCK lpECB,
+ int status,
const char *reason,
- const char *const *header_names,
- const char *const *header_values,
- unsigned int num_of_headers);
+ axutil_array_list_t *headers
+ );
axis2_status_t
@@ -66,6 +66,8 @@
axutil_hash_t *axis2_iis_worker_read_http_headers(const axutil_env_t * env, LPEXTENSION_CONTROL_BLOCK lpECB);
+AXIS2_IMPORT extern axis2_char_t *axis2_request_url_prefix;
+
static struct reasons
{
axis2_char_t * status_code;
@@ -73,7 +75,7 @@
} reasons[] = {
{"200 OK", 6},
{"202 Accepted", 12},
- { "500 Internal Server Error", 25}
+ {"500 Internal Server Error", 25}
};
struct axis2_iis_worker
@@ -125,32 +127,35 @@
LPEXTENSION_CONTROL_BLOCK lpECB)
{
axis2_conf_ctx_t * conf_ctx = NULL;
- axis2_msg_ctx_t * msg_ctx = NULL;
- axutil_stream_t * request_body = NULL;
axutil_stream_t * out_stream = NULL;
axis2_transport_out_desc_t * out_desc = NULL;
axis2_transport_in_desc_t * in_desc = NULL;
- axis2_bool_t processed = AXIS2_FALSE;
- /*int content_length = -1;*/
- /*axis2_char_t *req_url = NULL;*/
- axis2_char_t * body_string = NULL;
- int send_status = -1;
- axis2_http_out_transport_info_t * iis_out_transport_info = NULL;
- axis2_char_t * ctx_uuid = NULL;
- axis2_char_t soap_action[INTERNET_MAX_URL_LENGTH];
- axutil_string_t * soap_str_action = NULL;
+ axis2_char_t soap_action[INTERNET_MAX_URL_LENGTH];
axis2_char_t original_url[INTERNET_MAX_URL_LENGTH];
axis2_char_t req_url[INTERNET_MAX_URL_LENGTH];
- int body_str_len = 0;
- DWORD ret_val = 0;
DWORD cbSize = 0;
CHAR server_name[MAX_SERVERNAME];
axis2_char_t port[MAX_TCP_PORT_LEN];
- CHAR redirect_url[INTERNET_MAX_PATH_LENGTH];
- axis2_op_ctx_t *op_ctx = NULL;
+ axis2_char_t redirect_url[INTERNET_MAX_PATH_LENGTH];
+ axis2_char_t accept_language[INTERNET_MAX_PATH_LENGTH];
axutil_hash_t *headers = NULL;
- CHAR peer_ip[50];
- axutil_property_t *peer_property = NULL;
+ axis2_char_t peer_ip[50];
+ axis2_char_t accept_header[INTERNET_MAX_URL_LENGTH];
+ axis2_char_t accept_charset[INTERNET_MAX_URL_LENGTH];
+ /*axutil_property_t *peer_property = NULL;*/
+
+ axis2_http_header_t *content_type_header = NULL;
+ axis2_http_header_t *content_length_header = NULL;
+
+ /* New Code variables */
+ axis2_http_transport_in_t request;
+ axis2_http_transport_out_t response;
+
+ /* initialize tranport in structure */
+ axis2_http_transport_utils_transport_in_init(&request, env);
+
+ /* initialize tranport out structure */
+ axis2_http_transport_utils_transport_out_init(&response, env);
soap_action[0] = '\0';
@@ -158,20 +163,35 @@
if (!lpECB)
{
AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_INVALID_NULL_PARAM);
- return HSE_STATUS_ERROR;
+ return AXIS2_FAILURE;
}
conf_ctx = iis_worker->conf_ctx;
if (!conf_ctx)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NULL_CONFIGURATION_CONTEXT, AXIS2_FAILURE);
- return HSE_STATUS_ERROR;
+ return AXIS2_FAILURE;
}
+
cbSize = INTERNET_MAX_PATH_LENGTH;
- ret_val = lpECB->GetServerVariable(lpECB->ConnID, "SERVER_NAME", server_name,&cbSize);
+ if (lpECB->GetServerVariable(lpECB->ConnID, "SERVER_NAME", server_name, &cbSize) == FALSE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot get server name from IIS.");
+ return AXIS2_FAILURE;
+ }
cbSize = MAX_TCP_PORT_LEN;
- ret_val = lpECB->GetServerVariable(lpECB->ConnID, "SERVER_PORT", port, &cbSize);
+ if (lpECB->GetServerVariable(lpECB->ConnID, "SERVER_PORT", port, &cbSize) == FALSE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot get server port from IIS.");
+ return AXIS2_FAILURE;
+ }
+ request.svr_port = port;
+
cbSize = INTERNET_MAX_PATH_LENGTH;
- ret_val = lpECB->GetServerVariable(lpECB->ConnID, "HTTP_URL", redirect_url, &cbSize);
+ if(lpECB->GetServerVariable(lpECB->ConnID, "HTTP_URL", redirect_url, &cbSize) == FALSE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot get server port from IIS.");
+ return AXIS2_FAILURE;
+ }
/* We have a mapped URL only when the server version is 5 or less than that. */
if (server_version <= 5)
@@ -184,270 +204,162 @@
{
sprintf(req_url, "%s%s%s%s", "http://", server_name, port, redirect_url);
}
+ /* Set the request url */
+ request.request_uri = req_url;
out_stream = axutil_stream_create_basic(env);
out_desc = axis2_conf_get_transport_out(
axis2_conf_ctx_get_conf (iis_worker->conf_ctx, env), env, AXIS2_TRANSPORT_ENUM_HTTP);
in_desc = axis2_conf_get_transport_in(
axis2_conf_ctx_get_conf (iis_worker->conf_ctx, env), env, AXIS2_TRANSPORT_ENUM_HTTP);
- msg_ctx = axis2_msg_ctx_create(env, conf_ctx, in_desc, out_desc);
- axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
-
- axis2_msg_ctx_set_transport_out_stream(msg_ctx, env, out_stream);
-
- ctx_uuid = axutil_uuid_gen(env);
-
- if (ctx_uuid)
- {
- axutil_string_t * uuid_str =
- axutil_string_create_assume_ownership(env, &ctx_uuid);
- axis2_msg_ctx_set_svc_grp_ctx_id(msg_ctx, env, uuid_str);
- axutil_string_free(uuid_str, env);
- }
- iis_out_transport_info = axis2_iis_out_transport_info_create(env, lpECB);
-
- axis2_msg_ctx_set_out_transport_info(msg_ctx, env,
- &(iis_out_transport_info->out_transport));
- cbSize = INTERNET_MAX_URL_LENGTH;
+ /* Create the in message context */
+ request.msg_ctx = axis2_msg_ctx_create(env, conf_ctx, in_desc, out_desc);
+ axis2_msg_ctx_set_server_side(request.msg_ctx, env, AXIS2_TRUE);
+ axis2_msg_ctx_set_transport_out_stream(request.msg_ctx, env, out_stream);
+
+ /* Get the SOAPAction Header */
+ cbSize = INTERNET_MAX_URL_LENGTH;
if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_SOAPAction", soap_action, &cbSize))
- {
- soap_str_action = axutil_string_create(env, soap_action);
- }
- request_body = axutil_stream_create_iis(env, lpECB);
- if (!request_body)
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occured in"
- " creating input stream.");
- return HSE_STATUS_ERROR;
- }
-
- cbSize = 50;
- ret_val = lpECB->GetServerVariable(lpECB->ConnID, "REMOTE_ADDR", peer_ip, &cbSize);
- if (strlen(peer_ip) > 0)
- {
- peer_property = axutil_property_create(env);
- axutil_property_set_value(peer_property, env,
- axutil_strdup(env, peer_ip));
- axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_SVR_PEER_IP_ADDR,
- peer_property);
- /*AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Peer ip=%s", peer_ip);*/
+ {
+ request.soap_action = soap_action;
}
- /* Set the http headers into the message context */
- headers = axis2_iis_worker_read_http_headers(env, lpECB);
- if (axis2_msg_ctx_set_transport_headers(msg_ctx, env, headers) == AXIS2_FAILURE)
+ /* Create the in stream */
+ request.in_stream = axutil_stream_create_iis(env, lpECB);
+ if (!request.in_stream)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "IIS: Error occured in"
- " setting transport headers.");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occured in creating input stream.");
+ return AXIS2_FAILURE;
}
- if (AXIS2_STRICMP(lpECB->lpszMethod, "GET") == 0
- || AXIS2_STRICMP(lpECB->lpszMethod, "HEAD") == 0
- || AXIS2_STRICMP(lpECB->lpszMethod, "DELETE") == 0)
- {
- if (AXIS2_STRICMP(lpECB->lpszMethod, "GET") == 0)
- {
- processed = axis2_http_transport_utils_process_http_get_request
- (env, msg_ctx, request_body, out_stream, lpECB->lpszContentType,
- soap_str_action, req_url, conf_ctx,
- axis2_http_transport_utils_get_request_params(env,
- (axis2_char_t *) req_url));
- }
- else if (AXIS2_STRICMP(lpECB->lpszMethod, "HEAD") == 0)
- {
- processed = axis2_http_transport_utils_process_http_head_request
- (env, msg_ctx, request_body, out_stream, lpECB->lpszContentType,
- soap_str_action, req_url, conf_ctx,
- axis2_http_transport_utils_get_request_params(env,
- (axis2_char_t *) req_url));
- }
- else if (AXIS2_STRICMP(lpECB->lpszMethod, "DELETE") == 0)
- {
- processed = axis2_http_transport_utils_process_http_delete_request
- (env, msg_ctx, request_body, out_stream, lpECB->lpszContentType,
- soap_str_action, req_url, conf_ctx,
- axis2_http_transport_utils_get_request_params(env,
- (axis2_char_t *) req_url));
- }
- /* If this is not a valid GET request display the list of displayed services.*/
- if (processed == AXIS2_FAILURE)
- {
- body_string =
- axis2_http_transport_utils_get_services_html(env,
- conf_ctx);
- if (body_string)
- {
- body_str_len = (int)strlen(body_string);
- /* We are sure that the difference lies within the int range */
- }
- axis2_http_out_transport_info_set_content_type(iis_out_transport_info,
- env, "text/html");
- send_status = OK;
- }
- }
- else if (AXIS2_STRICMP(lpECB->lpszMethod, "POST") == 0 || AXIS2_STRICMP(lpECB->lpszMethod, "PUT") == 0)
- {
- axis2_status_t status = AXIS2_FAILURE;
- if (AXIS2_STRICMP(lpECB->lpszMethod, "POST") == 0)
- {
- status = axis2_http_transport_utils_process_http_post_request
- (env, msg_ctx, request_body, out_stream,
- lpECB->lpszContentType,
- lpECB->cbTotalBytes,
- soap_str_action,
- req_url);
- }
- if (AXIS2_STRICMP(lpECB->lpszMethod, "PUT") == 0)
- {
- status = axis2_http_transport_utils_process_http_put_request
- (env, msg_ctx, request_body, out_stream,
- lpECB->lpszContentType,
- lpECB->cbTotalBytes,
- soap_str_action,
- req_url);
- }
- /* generate a soap fault and send it*/
- if (status == AXIS2_FAILURE)
- {
- axis2_msg_ctx_t * fault_ctx = NULL;
- axis2_char_t * fault_code = NULL;
- axis2_engine_t * engine = axis2_engine_create(env, conf_ctx);
- if (!engine)
- {
- send_status = HTTP_INTERNAL_SERVER_ERROR;
- }
- if (axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
- {
- fault_code = AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
- AXIOM_SOAP11_FAULT_CODE_SENDER;
- }
- else
- {
- fault_code = AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
- AXIOM_SOAP12_SOAP_FAULT_VALUE_SENDER;
- }
- fault_ctx =
- axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx,
- fault_code,
- axutil_error_get_message(env->
- error));
+ /* Get the Remote Adrress */
+ if (lpECB->GetServerVariable(lpECB->ConnID, "REMOTE_ADDR", peer_ip, &cbSize))
+ {
+ request.remote_ip = peer_ip;
+ }
- axis2_engine_send_fault(engine, env, fault_ctx);
- if (out_stream)
- {
- body_string = axutil_stream_get_buffer(out_stream, env);
- body_str_len = axutil_stream_get_len(out_stream, env);
- }
- send_status = HTTP_INTERNAL_SERVER_ERROR;
- /*axis2_msg_ctx_free(fault_ctx, env);*/
- }
- }
- /* Nothing wrong has happen. So proceed with the request*/
- op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
- if (-1 == send_status)
- {
- if (axis2_op_ctx_get_response_written(op_ctx, env))
- {
- if (out_stream)
- {
- body_string = axutil_stream_get_buffer(out_stream, env);
- body_str_len = axutil_stream_get_len(out_stream, env);
- }
- send_status = OK;
- }
- else
- {
- send_status = HTTP_ACCEPTED;
- }
- }
- if (body_string)
- {
- const char *headers_names[] = {
- "Content-Type",
- "Content-Length"
- };
- char *headers_vhtml[2];
-
- headers_vhtml[1] = (char *) malloc(16);
- headers_vhtml[0] =
- axis2_iis_out_transport_get_content(iis_out_transport_info);
- sprintf(headers_vhtml[1], "%d", body_str_len);
- if (!start_response
- (lpECB, send_status, NULL, headers_names, headers_vhtml, 2))
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occured in"
- " writing response.");
- }
- if (AXIS2_STRICMP(lpECB->lpszMethod, "HEAD") != 0)
- {
- if (!write_response(lpECB, body_string, body_str_len))
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occured in"
- " writing response.");
- }
- }
- AXIS2_FREE(env->allocator, body_string);
- body_string = NULL;
- }
- else
+ /* Set the http headers into the message context */
+ headers = axis2_iis_worker_read_http_headers(env, lpECB);
+ if (axis2_msg_ctx_set_transport_headers(request.msg_ctx, env, headers) == AXIS2_FAILURE)
{
- if (!start_response(lpECB, send_status, NULL, NULL, NULL, 0))
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occured in"
- " writing response.");
- }
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "IIS: Error occured in setting transport headers.");
}
- if (op_ctx)
- {
- axis2_msg_ctx_t *out_msg_ctx = NULL,
- *in_msg_ctx = NULL;
- axis2_msg_ctx_t **msg_ctx_map = NULL;
- axis2_char_t *msg_id = NULL;
- axis2_conf_ctx_t *conf_ctx = NULL;
- msg_ctx_map = axis2_op_ctx_get_msg_ctx_map(op_ctx, env);
-
- out_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_OUT];
- in_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN];
-
- if (out_msg_ctx)
- {
- axis2_msg_ctx_free(out_msg_ctx, env);
- out_msg_ctx = NULL;
- msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_OUT] = NULL;
- }
-
- if (in_msg_ctx)
- {
- msg_id =
- axutil_strdup(env, axis2_msg_ctx_get_msg_id(in_msg_ctx, env));
- conf_ctx = axis2_msg_ctx_get_conf_ctx(in_msg_ctx, env);
- axis2_msg_ctx_reset_out_transport_info(in_msg_ctx, env);
- axis2_msg_ctx_reset_transport_out_stream(in_msg_ctx, env);
- axis2_msg_ctx_free(in_msg_ctx, env);
- in_msg_ctx = NULL;
- msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN] = NULL;
- }
-
- if (!axis2_op_ctx_is_in_use(op_ctx, env))
- {
- axis2_op_ctx_destroy_mutex(op_ctx, env);
- if (conf_ctx && msg_id)
- {
- axis2_conf_ctx_register_op_ctx(conf_ctx, env, msg_id, NULL);
- AXIS2_FREE(env->allocator, msg_id);
- }
- axis2_op_ctx_free(op_ctx, env);
- }
+ /* Set the content length */
+ request.content_length = lpECB->cbTotalBytes;
+ /* Set the HTTP method */
+ if (axutil_strcasecmp(lpECB->lpszMethod, "POST") == 0)
+ {
+ request.request_method = AXIS2_HTTP_METHOD_POST;
+ }
+ else if (axutil_strcasecmp(lpECB->lpszMethod, "GET") == 0)
+ {
+ request.request_method = AXIS2_HTTP_METHOD_GET;
+ }
+ else if (axutil_strcasecmp(lpECB->lpszMethod, "HEAD") == 0)
+ {
+ request.request_method = AXIS2_HTTP_METHOD_HEAD;
+ }
+ else if (axutil_strcasecmp(lpECB->lpszMethod, "PUT") == 0)
+ {
+ request.request_method = AXIS2_HTTP_METHOD_PUT;
+ }
+ else if (axutil_strcasecmp(lpECB->lpszMethod, "DELETE") == 0)
+ {
+ request.request_method = AXIS2_HTTP_METHOD_DELETE;
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "IIS: Unsupported HTTP Method.");
+ return AXIS2_FAILURE;
+ }
+ /* Set the URL prefix */
+ request.request_url_prefix = axis2_request_url_prefix;
+ /* Create the transport out info */
+ request.out_transport_info = axis2_iis_out_transport_info_create(env, lpECB);
+ /* Set the content type */
+ request.content_type = lpECB->lpszContentType;
+
+ /* Get accept headaer */
+ cbSize = INTERNET_MAX_PATH_LENGTH;
+ if(lpECB->GetServerVariable(lpECB->ConnID, "HTTP_Accept", accept_header, &cbSize))
+ {
+ request.accept_header = accept_header;
+ }
+
+ /* Get the accept langauge */
+ cbSize = INTERNET_MAX_PATH_LENGTH;
+ if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_Accept-Language", accept_language, &cbSize))
+ {
+ request.accept_language_header = accept_language;
+ }
+
+ cbSize = INTERNET_MAX_PATH_LENGTH;
+ if (lpECB->GetServerVariable(lpECB->ConnID, "HTTP_Accept-Charset", accept_charset, &cbSize))
+ {
+ request.accept_charset_header = accept_charset;
+ }
- } /* Done freeing message contexts */
- if (request_body)
- {
- axutil_stream_free(request_body, env);
- request_body = NULL;
- }
- msg_ctx = NULL;
- return HSE_STATUS_SUCCESS;
+ /* Now we have set everything. We can call process method to process the request */
+ if (axis2_http_transport_utils_process_request(env, conf_ctx, &request, &response) == AXIS2_FAILURE)
+ {
+ return AXIS2_FAILURE;
+ }
+
+ /* Write the response */
+ if (response.response_data && response.response_data_length > 0)
+ {
+ axis2_char_t content_length_str[16]={0};
+ axis2_bool_t is_out_headers_created = AXIS2_FALSE;
+ if (!response.output_headers)
+ {
+ response.output_headers = axutil_array_list_create(env, 2);
+ is_out_headers_created = AXIS2_TRUE;
+ }
+ sprintf(content_length_str, "%d", response.response_data_length);
+ if (!response.content_type)
+ {
+ content_type_header = axis2_http_header_create(env, "Content-Type", axis2_iis_out_transport_get_content(request.out_transport_info));
+ }
+ else
+ {
+ content_type_header = axis2_http_header_create(env, "Content-Type", response.content_type);
+ }
+ content_length_header = axis2_http_header_create(env, "Content-Length", content_length_str);
+ axutil_array_list_add(response.output_headers, env, content_length_header);
+ axutil_array_list_add(response.output_headers, env, content_type_header);
+ /* Write the headers */
+ start_response(env, lpECB, response.http_status_code, response.http_status_code_name, response.output_headers);
+ /* Write the response body */
+ if(write_response(lpECB, response.response_data, response.response_data_length) == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "IIS: Writing data to IIS");
+ return AXIS2_FAILURE;
+ }
+ if (is_out_headers_created)
+ {
+ if (content_length_header)
+ {
+ axis2_http_header_free(content_length_header, env);
+ }
+ if (content_type_header)
+ {
+ axis2_http_header_free(content_type_header, env);
+ }
+ axutil_array_list_free(response.output_headers, env);
+ }
+ }
+ else
+ {
+ /* If we don't have a body we should write the HTTP headers */
+ start_response(env, lpECB, response.http_status_code, response.http_status_code_name, response.output_headers);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Response is NULL");
+ }
+
+ /* Do some cleaning */
+ axis2_http_transport_utils_transport_in_uninit(&request, env);
+ axis2_http_transport_utils_transport_out_uninit(&response, env);
+ return AXIS2_SUCCESS;
}
@@ -470,29 +382,31 @@
buf + written, &try_to_write,
0))
{
- return FALSE;
+ return AXIS2_FAILURE;
}
written += try_to_write;
}
}
- return TRUE;
+ return AXIS2_SUCCESS;
}
- return FALSE;
+ return AXIS2_FAILURE;
}
-axis2_status_t AXIS2_CALL start_response(LPEXTENSION_CONTROL_BLOCK lpECB,
+axis2_status_t AXIS2_CALL start_response(const axutil_env_t *env,
+ LPEXTENSION_CONTROL_BLOCK lpECB,
int status,
const char *reason,
- const char *const *header_names,
- const char *const *header_values,
- unsigned int num_of_headers)
+ axutil_array_list_t *headers
+ )
{
static char crlf[3] = { (char) 13, (char) 10, '\0' };
+ unsigned int num_of_headers = 0;
+
if (status < 100 || status > 1000)
{
- return FALSE;
+ return AXIS2_FAILURE;
}
if (lpECB)
{
@@ -531,17 +445,18 @@
break;
}
}
-
/*
* Create response headers string
*/
- if (num_of_headers)
+ if (headers && (num_of_headers = axutil_array_list_size(headers, env)) > 0)
{
size_t i, len_of_headers;
+ axis2_http_header_t *header = NULL;
for (i = 0, len_of_headers = 0; i < num_of_headers; i++)
{
- len_of_headers += strlen(header_names[i]);
- len_of_headers += strlen(header_values[i]);
+ header = axutil_array_list_get(headers, env, (int)i);
+ len_of_headers += strlen(axis2_http_header_get_name(header, env));
+ len_of_headers += strlen(axis2_http_header_get_value(header, env));
len_of_headers += 4; /* extra for colon, space and crlf */
}
len_of_headers += 3; /* crlf and terminating null char */
@@ -549,9 +464,10 @@
headers_str[0] = '\0';
for (i = 0; i < num_of_headers; i++)
{
- strcat(headers_str, header_names[i]);
+ header = axutil_array_list_get(headers, env, (int)i);
+ strcat(headers_str, axis2_http_header_get_name(header, env));
strcat(headers_str, ": ");
- strcat(headers_str, header_values[i]);
+ strcat(headers_str, axis2_http_header_get_value(header, env));
strcat(headers_str, "\r\n");
}
strcat(headers_str, "\r\n");
@@ -567,11 +483,11 @@
(LPDWORD) & len_of_status,
(LPDWORD) headers_str))
{
- return FALSE;
+ return AXIS2_FAILURE;
}
- return TRUE;
+ return AXIS2_SUCCESS;
}
- return FALSE;
+ return AXIS2_FAILURE;
}
axis2_status_t AXIS2_CALL axis2_worker_get_original_url(char url[],
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/IIS/axis2_isapi_plugin.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/IIS/axis2_isapi_plugin.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/IIS/axis2_isapi_plugin.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/IIS/axis2_isapi_plugin.c Thu Jul 3 08:35:44 2008
@@ -75,13 +75,13 @@
"<head><title> An IIS server error occurred. </title></head>\r\n"
"<h1> An IIS server error occurred </h1>\r\n"
"<hr>\r\n"
- "An error occurred in IIS while processing this request.";
+ "An error occurred in IIS while processing this request.</hr></html>";
axis2_char_t initializing_error[] = "<html>\r\n"
"<head><title> An IIS server error occurred. </title></head>\r\n"
"<h1> An IIS server error occurred </h1>\r\n"
"<hr>\r\n"
- "An error occurred while initilizing Axis2/C. Please verify the configuration";
+ "An error occurred while initilizing Axis2/C.</hr></html>";
/*
@@ -227,6 +227,7 @@
if (AXIS2_FAILURE == init_axis2())
{
send_error(pecb, initializing_error);
+ return HSE_STATUS_ERROR;
}
#if _WIN32_WINNT >= 0x0502
SetDllDirectory( szOriginalPath );
Propchange: webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/apache2/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jul 3 08:35:44 2008
@@ -0,0 +1,2 @@
+.deps
+.libs
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/apache2/apache2_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/apache2/apache2_worker.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/apache2/apache2_worker.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/apache2/apache2_worker.c Thu Jul 3 08:35:44 2008
@@ -34,9 +34,24 @@
#include <axiom_soap.h>
#include <axutil_class_loader.h>
#include <axutil_string_util.h>
+#include <axiom_mime_output.h>
#define READ_SIZE 2048
+static axis2_status_t apache2_worker_send_mtom_message(
+ request_rec *request,
+ const axutil_env_t * env,
+ axutil_array_list_t *mime_parts);
+
+static axis2_status_t
+axis2_http_transport_utils_send_attachment(
+ const axutil_env_t * env,
+ request_rec *request,
+ FILE *fp,
+ axis2_byte_t *buffer,
+ int buffer_size);
+
+
struct axis2_apache2_worker
{
axis2_conf_ctx_t *conf_ctx;
@@ -173,6 +188,8 @@
axis2_char_t *accept_charset_header_value = NULL;
axis2_char_t *accept_language_header_value = NULL;
axis2_char_t *content_language_header_value = NULL;
+ axis2_bool_t do_mtom = AXIS2_FALSE;
+ axutil_array_list_t *mime_parts = NULL;
AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
AXIS2_PARAM_CHECK(env->error, request, AXIS2_CRITICAL_FAILURE);
@@ -214,10 +231,24 @@
content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_PLAIN;
}
request->content_type = content_type;
+
+ out_desc = axis2_conf_get_transport_out(axis2_conf_ctx_get_conf
+ (apache2_worker->conf_ctx, env),
+ env, AXIS2_TRANSPORT_ENUM_HTTP);
+ in_desc =
+ axis2_conf_get_transport_in(axis2_conf_ctx_get_conf
+ (apache2_worker->conf_ctx, env), env,
+ AXIS2_TRANSPORT_ENUM_HTTP);
+
+ msg_ctx = axis2_msg_ctx_create(env, conf_ctx, in_desc, out_desc);
+ axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
+
if (request->read_chunked == AXIS2_TRUE && 0 == content_length)
{
content_length = -1;
request->chunked = 1;
+ /*axis2_msg_ctx_set_transfer_encoding(msg_ctx, env,
+ AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED);*/
}
if (!http_version)
{
@@ -229,7 +260,7 @@
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Client HTTP version %s",
http_version);
- out_desc = axis2_conf_get_transport_out(axis2_conf_ctx_get_conf
+ /*out_desc = axis2_conf_get_transport_out(axis2_conf_ctx_get_conf
(apache2_worker->conf_ctx, env),
env, AXIS2_TRANSPORT_ENUM_HTTP);
in_desc =
@@ -238,7 +269,7 @@
AXIS2_TRANSPORT_ENUM_HTTP);
msg_ctx = axis2_msg_ctx_create(env, conf_ctx, in_desc, out_desc);
- axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
+ axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);*/
peer_ip = request->connection->remote_ip;
@@ -1159,6 +1190,18 @@
out_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_OUT];
in_msg_ctx = msg_ctx_map[AXIS2_WSDL_MESSAGE_LABEL_IN];
+ /* In mtom case we send the attachment differently */
+
+ do_mtom = axis2_msg_ctx_get_doing_mtom(out_msg_ctx, env);
+ if(do_mtom)
+ {
+ mime_parts = axis2_msg_ctx_get_mime_parts(out_msg_ctx, env);
+ if(!mime_parts)
+ {
+ return AXIS2_FAILURE;
+ }
+ }
+
if (out_msg_ctx)
{
axis2_msg_ctx_free(out_msg_ctx, env);
@@ -1189,7 +1232,24 @@
}
} /* Done freeing message contexts */
- if (body_string)
+
+ /* We send the message in parts when doing MTOM */
+
+ if(do_mtom)
+ {
+ axis2_status_t mtom_status = AXIS2_FAILURE;
+ mtom_status = apache2_worker_send_mtom_message(request, env, mime_parts);
+ if(mtom_status == AXIS2_SUCCESS)
+ {
+ send_status = DONE;
+ }
+ else
+ {
+ send_status = DECLINED;
+ }
+ }
+
+ else if (body_string)
{
ap_rwrite(body_string, body_string_len, request);
body_string = NULL;
@@ -1252,3 +1312,185 @@
axutil_stream_free(tmp_stream, env);
return buffer;
}
+
+
+static axis2_status_t apache2_worker_send_mtom_message(
+ request_rec *request,
+ const axutil_env_t * env,
+ axutil_array_list_t *mime_parts)
+{
+ int i = 0;
+ axiom_mime_output_part_t *mime_part = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ /*int written = 0;*/
+ int len = 0;
+
+ if(mime_parts)
+ {
+ for(i = 0; i < axutil_array_list_size
+ (mime_parts, env); i++)
+ {
+ mime_part = (axiom_mime_output_part_t *)axutil_array_list_get(
+ mime_parts, env, i);
+ if((mime_part->type) == AXIOM_MIME_OUTPUT_PART_BUFFER)
+ {
+ len = 0;
+ /*written = 0;
+ while(written < mime_part->part_size)
+ {
+ len = 0;
+ len = ap_rwrite(mime_part->part + written, mime_part->part_size - written,
+ request);
+ ap_rflush(request);
+ if (len == -1)
+ {
+ status = AXIS2_FAILURE;
+ break;
+ }
+ else
+ {
+ written += len;
+ }
+ }*/
+ len = ap_rwrite(mime_part->part, mime_part->part_size, request);
+ ap_rflush(request);
+ if(len == -1)
+ {
+ status = AXIS2_FAILURE;
+ break;
+ }
+ }
+ else if((mime_part->type) == AXIOM_MIME_OUTPUT_PART_FILE)
+ {
+ FILE *f = NULL;
+ axis2_byte_t *output_buffer = NULL;
+ int output_buffer_size = 0;
+
+ f = fopen(mime_part->file_name, "rb");
+ if (!f)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Error opening file %s for reading",
+ mime_part->file_name);
+ return AXIS2_FAILURE;
+ }
+ if(mime_part->part_size > AXIS2_MTOM_OUTPUT_BUFFER_SIZE)
+ {
+ output_buffer_size = AXIS2_MTOM_OUTPUT_BUFFER_SIZE;
+ }
+ else
+ {
+ output_buffer_size = mime_part->part_size;
+ }
+
+ output_buffer = AXIS2_MALLOC(env->allocator,
+ (output_buffer_size + 1) * sizeof(axis2_char_t));
+
+
+ status = axis2_http_transport_utils_send_attachment(env, request,
+ f, output_buffer, output_buffer_size);
+ if(status == AXIS2_FAILURE)
+ {
+ return status;
+ }
+ }
+ else
+ {
+ return AXIS2_FAILURE;
+ }
+ if(status == AXIS2_FAILURE)
+ {
+ break;
+ }
+ }
+ return status;
+ }
+ else
+ {
+ return AXIS2_FAILURE;
+ }
+}
+
+
+static axis2_status_t
+axis2_http_transport_utils_send_attachment(
+ const axutil_env_t * env,
+ request_rec *request,
+ FILE *fp,
+ axis2_byte_t *buffer,
+ int buffer_size)
+{
+
+ int count = 0;
+ int len = 0;
+ /*int written = 0;*/
+ axis2_status_t status = AXIS2_SUCCESS;
+
+ do
+ {
+ count = (int)fread(buffer, 1, buffer_size + 1, fp);
+ if (ferror(fp))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Error in reading file containg the attachment");
+ if (buffer)
+ {
+ AXIS2_FREE(env->allocator, buffer);
+ }
+ fclose(fp);
+ return AXIS2_FAILURE;
+ }
+
+ if(count > 0)
+ {
+ len = 0;
+ /*written = 0;
+ while(written < count)
+ {
+ len = 0;
+ len = ap_rwrite(buffer + written, count - written, request);
+ ap_rflush(request);
+ if (len == -1)
+ {
+ status = AXIS2_FAILURE;
+ break;
+ }
+ else
+ {
+ written += len;
+ }
+ }*/
+ len = ap_rwrite(buffer, count, request);
+ ap_rflush(request);
+ if(len == -1)
+ {
+ status = AXIS2_FAILURE;
+ break;
+ }
+ }
+ else
+ {
+ if (buffer)
+ {
+ AXIS2_FREE(env->allocator, buffer);
+ }
+ fclose(fp);
+ return AXIS2_FAILURE;
+ }
+ memset(buffer, 0, buffer_size);
+ if(status == AXIS2_FAILURE)
+ {
+ if (buffer)
+ {
+ AXIS2_FREE(env->allocator, buffer);
+ }
+ fclose(fp);
+ return AXIS2_FAILURE;
+ }
+ }
+ while(!feof(fp));
+
+ fclose(fp);
+ return AXIS2_SUCCESS;
+}
+
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/apache2/mod_axis2.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/apache2/mod_axis2.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/apache2/mod_axis2.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/server/apache2/mod_axis2.c Thu Jul 3 08:35:44 2008
@@ -330,7 +330,7 @@
return DECLINED;
}
/* Set up the read policy from the client. */
- if ((rv = ap_setup_client_block(req, REQUEST_CHUNKED_DECHUNK)) != OK)
+ if ((rv = ap_setup_client_block(req, REQUEST_CHUNKED_DECHUNK/*REQUEST_CHUNKED_PASS*/)) != OK)
{
return rv;
}
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/util/http_transport_utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/util/http_transport_utils.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/util/http_transport_utils.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/src/core/transport/http/util/http_transport_utils.c Thu Jul 3 08:35:44 2008
@@ -199,6 +199,66 @@
/***************************** End of function headers ************************/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_http_transport_utils_transport_out_init(axis2_http_transport_out_t *response,
+ const axutil_env_t *env)
+{
+ response->http_status_code_name = NULL;
+ response->http_status_code = 0;
+ response->msg_ctx = NULL;
+ response->response_data = NULL;
+ response->content_type = NULL;
+ response->response_data_length = 0;
+ response->content_language = NULL;
+ response->output_headers = NULL;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_http_transport_utils_transport_out_uninit(axis2_http_transport_out_t *response,
+ const axutil_env_t *env)
+{
+ if (response->msg_ctx)
+ {
+ axis2_msg_ctx_free(response->msg_ctx, env);
+ }
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_http_transport_utils_transport_in_init(axis2_http_transport_in_t *request,
+ const axutil_env_t *env)
+{
+ request->content_type = NULL;
+ request->content_length = 0;
+ request->msg_ctx = NULL;
+ request->soap_action = NULL;
+ request->request_uri = NULL;
+ request->in_stream = NULL;
+ request->remote_ip = NULL;
+ request->svr_port = NULL;
+ request->transfer_encoding = NULL;
+ request->accept_header = NULL;
+ request->accept_language_header = NULL;
+ request->accept_charset_header = NULL;
+ request->request_method = 0;
+ request->out_transport_info = NULL;
+ request->request_url_prefix = NULL;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_http_transport_utils_transport_in_uninit(axis2_http_transport_in_t *request,
+ const axutil_env_t *env)
+{
+ if (request->msg_ctx)
+ {
+ axis2_msg_ctx_reset_out_transport_info(request->msg_ctx, env);
+ axis2_msg_ctx_free(request->msg_ctx, env);
+ }
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_http_transport_utils_process_http_post_request(
const axutil_env_t * env,
axis2_msg_ctx_t * msg_ctx,
@@ -317,8 +377,20 @@
and also gives out a content lenght of 0.
We need to fix the transport design to fix sutuations like this.
*/
- callback_ctx->content_length = AXIS2_CHUNKED_CONTENT_LENGTH;
- callback_ctx->unread_len = callback_ctx->content_length;
+ /*callback_ctx->content_length = AXIS2_CHUNKED_CONTENT_LENGTH;
+ callback_ctx->unread_len = callback_ctx->content_length;*/
+ callback_ctx->chunked_stream =
+ axutil_http_chunked_stream_create(env, in_stream);
+
+ if (!callback_ctx->chunked_stream)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occured in"
+ " creating in chunked stream.");
+ return AXIS2_FAILURE;
+ }
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "HTTP"
+ " stream chunked");
}
}
@@ -1708,7 +1780,7 @@
}
else
{
- wsdl_string = "Unable to retrieve wsdl for this service";
+ wsdl_string = axutil_strdup(env, "Unable to retrieve wsdl for this service");
}
return wsdl_string;
@@ -1829,11 +1901,15 @@
(axutil_stream_t *) ((axis2_callback_info_t *) ctx)->in_stream;
--size; /* reserve space to insert trailing null */
len = axutil_stream_read(in_stream, env, buffer, size);
- if (len >= 0)
+ if (len > 0)
{
buffer[len] = AXIS2_ESC_NULL;
((axis2_callback_info_t *) ctx)->unread_len -= len;
}
+ else if(len == 0)
+ {
+ ((axis2_callback_info_t *) ctx)->unread_len = 0;
+ }
}
return len;
}
@@ -2416,14 +2492,12 @@
axis2_transport_out_desc_t *out_desc = NULL;
axis2_transport_in_desc_t *in_desc = NULL;
axutil_string_t *soap_action = NULL;
- axis2_char_t *soap_action_header_txt = NULL;
axis2_bool_t processed = AXIS2_FALSE;
axis2_char_t *body_string = NULL;
axis2_char_t *ctx_uuid = NULL;
axis2_op_ctx_t *op_ctx = NULL;
axis2_char_t *peer_ip = NULL;
axutil_property_t *peer_property = NULL;
-/* int read_chunked =0; */
axis2_msg_ctx_t *out_msg_ctx = NULL;
axis2_msg_ctx_t **msg_ctx_map = NULL;
@@ -2455,7 +2529,7 @@
env, AXIS2_TRANSPORT_ENUM_HTTP);
axis2_msg_ctx_set_server_side(request->msg_ctx , env, AXIS2_TRUE);
-
+ msg_ctx = request->msg_ctx;
peer_ip = request->remote_ip;
if (peer_ip)
@@ -2512,7 +2586,7 @@
if(request->soap_action)
{
- soap_action = axutil_string_create(env, soap_action_header_txt);
+ soap_action = axutil_string_create(env, request->soap_action);
}
if (request->request_method == AXIS2_HTTP_METHOD_GET ||
@@ -2674,7 +2748,7 @@
}
}
else if (AXIS2_HTTP_METHOD_POST == request->request_method ||
- AXIS2_HTTP_METHOD_POST == request->request_method)
+ AXIS2_HTTP_METHOD_PUT == request->request_method)
{
if (AXIS2_HTTP_METHOD_POST == request->request_method)
{
@@ -2730,7 +2804,7 @@
}
status = AXIS2_SUCCESS;
}
- else if (status == AXIS2_FAILURE)
+ else if (processed == AXIS2_FAILURE)
{
axis2_msg_ctx_t *fault_ctx = NULL;
axis2_char_t *fault_code = NULL;
@@ -2804,123 +2878,122 @@
if ((request->accept_header || request->accept_charset_header ||
request->accept_language_header) && do_rest)
{
- axis2_char_t *content_type_header_value = NULL;
- axis2_char_t *temp = NULL;
- axis2_char_t *language_header_value = NULL;
-
- content_type_header_value = (axis2_char_t *) request->content_type;
- language_header_value = axis2_msg_ctx_get_content_language(out_msg_ctx,env);
- if (content_type_header_value)
- {
- temp = axutil_strdup(env, content_type_header_value);
- }
- if (temp)
- {
- axis2_char_t *content_type = NULL;
- axis2_char_t *char_set = NULL;
- axis2_char_t *temp2 = NULL;
-
- temp2 = strchr(temp, ';');
- if (temp2)
- {
- *temp2 = '\0';
- temp2++;
- char_set = axutil_strcasestr(temp2, AXIS2_HTTP_CHAR_SET_ENCODING);
- }
- if (char_set)
+ axis2_char_t *content_type_header_value = NULL;
+ axis2_char_t *temp = NULL;
+ axis2_char_t *language_header_value = NULL;
+
+ content_type_header_value = (axis2_char_t *) request->content_type;
+ language_header_value = axis2_msg_ctx_get_content_language(out_msg_ctx,env);
+ if (content_type_header_value)
{
- char_set = axutil_strltrim(env, char_set, " \t=");
+ temp = axutil_strdup(env, content_type_header_value);
}
- if (char_set)
- {
- temp2 = strchr(char_set, ';');
- }
- if (temp2)
- {
- *temp2 = '\0';
- }
- content_type = axutil_strtrim(env, temp, NULL);
-
if (temp)
{
- AXIS2_FREE(env->allocator, temp);
- temp = NULL;
- }
- if (content_type && request->accept_header &&
- !axutil_strcasestr(request->accept_header, content_type))
- {
- temp2 = strchr(content_type, '/');
+ axis2_char_t *content_type = NULL;
+ axis2_char_t *char_set = NULL;
+ axis2_char_t *temp2 = NULL;
+
+ temp2 = strchr(temp, ';');
if (temp2)
{
*temp2 = '\0';
- temp = AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * ((int)strlen(content_type) + 3));
- if (!temp)
- {
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- return AXIS2_FALSE;
- }
- sprintf(temp, "%s/*", content_type);
- if (!axutil_strcasestr(request->accept_header, temp) &&
- !strstr(request->accept_header, AXIS2_HTTP_HEADER_ACCEPT_ALL))
+ temp2++;
+ char_set = axutil_strcasestr(temp2, AXIS2_HTTP_CHAR_SET_ENCODING);
+ }
+ if (char_set)
+ {
+ char_set = axutil_strltrim(env, char_set, " \t=");
+ }
+ if (char_set)
+ {
+ temp2 = strchr(char_set, ';');
+ }
+ if (temp2)
+ {
+ *temp2 = '\0';
+ }
+ content_type = axutil_strtrim(env, temp, NULL);
+
+ if (temp)
+ {
+ AXIS2_FREE(env->allocator, temp);
+ temp = NULL;
+ }
+ if (content_type && request->accept_header &&
+ !axutil_strcasestr(request->accept_header, content_type))
+ {
+ temp2 = strchr(content_type, '/');
+ if (temp2)
{
- response->response_data =
- axis2_http_transport_utils_get_not_acceptable(env, conf_ctx);
- response->content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML;
- if (response->response_data)
+ *temp2 = '\0';
+ temp = AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_char_t) * ((int)strlen(content_type) + 3));
+ if (!temp)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FALSE;
+ }
+ sprintf(temp, "%s/*", content_type);
+ if (!axutil_strcasestr(request->accept_header, temp) &&
+ !strstr(request->accept_header, AXIS2_HTTP_HEADER_ACCEPT_ALL))
{
- response->response_data_length = axutil_strlen(response->response_data);
+ response->response_data =
+ axis2_http_transport_utils_get_not_acceptable(env, conf_ctx);
+ response->content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML;
+ if (response->response_data)
+ {
+ response->response_data_length = axutil_strlen(response->response_data);
+ }
+ response->http_status_code = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_VAL;
+ response->http_status_code_name = AXIS2_HTTP_RESPONSE_NOT_IMPLEMENTED_CODE_NAME;
+ status = AXIS2_TRUE;
}
- response->http_status_code = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_VAL;
- response->http_status_code_name = AXIS2_HTTP_RESPONSE_NOT_IMPLEMENTED_CODE_NAME;
- status = AXIS2_TRUE;
+ AXIS2_FREE(env->allocator, temp);
}
- AXIS2_FREE(env->allocator, temp);
}
- }
- if (content_type)
- {
- AXIS2_FREE(env->allocator, content_type);
- }
- if (char_set && request->accept_charset_header &&
- !axutil_strcasestr(request->accept_charset_header , char_set))
- {
- response->response_data =
- axis2_http_transport_utils_get_not_acceptable(env, conf_ctx);
- response->content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML;
+ if (content_type)
+ {
+ AXIS2_FREE(env->allocator, content_type);
+ }
+ if (char_set && request->accept_charset_header &&
+ !axutil_strcasestr(request->accept_charset_header , char_set))
+ {
+ response->response_data =
+ axis2_http_transport_utils_get_not_acceptable(env, conf_ctx);
+ response->content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML;
- if (response->response_data)
+ if (response->response_data)
+ {
+ response->response_data_length= axutil_strlen(response->response_data);
+ }
+ status = AXIS2_SUCCESS;
+ response->http_status_code = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_VAL;
+ response->http_status_code_name = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_NAME;
+ }
+ if (char_set)
{
- response->response_data_length= axutil_strlen(response->response_data);
+ AXIS2_FREE(env->allocator, char_set);
}
- status = AXIS2_SUCCESS;
- response->http_status_code = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_VAL;
- response->http_status_code_name = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_NAME;
- }
- if (char_set)
- {
- AXIS2_FREE(env->allocator, char_set);
}
- }
- if (language_header_value)
- {
- if (request->accept_language_header &&
- !axutil_strcasestr(request->accept_language_header , language_header_value))
+ if (language_header_value)
{
- response->response_data =
- axis2_http_transport_utils_get_not_acceptable(env, conf_ctx);
- response->content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML;
- if (response->response_data)
+ if (request->accept_language_header &&
+ !axutil_strcasestr(request->accept_language_header , language_header_value))
{
- response->response_data_length = axutil_strlen(response->response_data);
+ response->response_data =
+ axis2_http_transport_utils_get_not_acceptable(env, conf_ctx);
+ response->content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_HTML;
+ if (response->response_data)
+ {
+ response->response_data_length = axutil_strlen(response->response_data);
+ }
+ response->http_status_code = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_VAL;
+ response->http_status_code_name = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_NAME;
}
- response->http_status_code = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_VAL;
- response->http_status_code_name = AXIS2_HTTP_RESPONSE_NOT_ACCEPTABLE_CODE_NAME;
}
}
}
-
- }
if (status == AXIS2_FAILURE)
{
axis2_bool_t do_rest = AXIS2_FALSE;
@@ -3027,7 +3100,6 @@
}
}
axutil_string_free(soap_action, env);
-
msg_ctx = NULL;
return status;
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/src/modules/mod_addr/addr_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/src/modules/mod_addr/addr_in_handler.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/src/modules/mod_addr/addr_in_handler.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/src/modules/mod_addr/addr_in_handler.c Thu Jul 3 08:35:44 2008
@@ -664,7 +664,7 @@
axiom_element_get_attribute(header_block_ele, env, wsa_qname);
if (om_attr)
{
- attr_value = axiom_attribute_get_localname(om_attr, env);
+ attr_value = axiom_attribute_get_value(om_attr, env);
if (!axutil_strcmp(attr_value, AXIS2_WSA_TYPE_ATTRIBUTE_VALUE))
{
axis2_msg_info_headers_add_ref_param(msg_info_headers, env,
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/entry.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/entry.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/entry.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/entry.c Thu Jul 3 08:35:44 2008
@@ -427,7 +427,7 @@
axutil_thread_t * thd,
void *data)
{
- tcpmon_entry_request_data_t *req_data = data;
+ tcpmon_entry_request_data_t *req_data = (tcpmon_entry_request_data_t *) data;
const axutil_env_t *env = NULL;
int client_socket = -1;
int host_socket = -1;
@@ -464,7 +464,6 @@
target_port = TCPMON_SESSION_GET_TARGET_PORT(session, env);
target_host = TCPMON_SESSION_GET_TARGET_HOST(session, env);
-
if (target_port == -1 || target_host == NULL)
{
axutil_network_handler_close_socket(env, client_socket);
@@ -508,8 +507,9 @@
}
buffer = read_current_stream(client_stream, env, &buffer_size,
- &headers, &content);
+ &headers, &content);
+ headers =(char *) str_replace(headers,"localhost", target_host);
test_bit = TCPMON_SESSION_GET_TEST_BIT(session, env);
if (test_bit)
@@ -531,7 +531,7 @@
/*free ( localTime); */
- entry_impl->sent_headers = headers;
+ entry_impl->sent_headers = headers;
entry_impl->sent_data = content;
entry_impl->sent_data_length = buffer_size;
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/session.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/session.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/session.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/session.c Thu Jul 3 08:35:44 2008
@@ -372,7 +372,7 @@
session_impl = AXIS2_INTF_TO_IMPL(session);
session_impl->target_host =
- (axis2_char_t *) axutil_strdup(env, target_host);
+ (axis2_char_t *) axutil_strdup(env, target_host);
return AXIS2_SUCCESS;
}
@@ -492,7 +492,7 @@
axutil_thread_t * thd,
void *data)
{
- tcpmon_session_server_thread_data_t *thread_data = data;
+ tcpmon_session_server_thread_data_t *thread_data = (tcpmon_session_server_thread_data_t *)data;
tcpmon_session_impl_t *session_impl = NULL;
const axutil_env_t *env = NULL;
int listen_socket = -1;
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/tcpmon.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/tcpmon.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/tcpmon.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/tools/tcpmon/src/tcpmon.c Thu Jul 3 08:35:44 2008
@@ -73,7 +73,7 @@
int listen_port = 9099,
target_port = 9090; /* the default port simple axis2 server is run on 9090 */
int test_bit = 0;
- int format_bit = 0;
+ int format_bit = 0; /* pretty print the request/response SOAP messages */
int ii = 1;
if (!axutil_strcmp(argv[1], "-h"))
@@ -548,7 +548,7 @@
file = fopen(tcpmon_traffic_log, "rb");
- if (NULL == file)
+ if (!file)
{
printf("\ncould not create or open log-file\n");
return -1;
@@ -778,10 +778,10 @@
sizeof(axis2_char_t) * header_len + 1);
memcpy(tmp1, tmp2, header_len);
tmp1[header_len] = '\0';
- header_len = 16 + (int)strlen(listen_host);
+ header_len = 16 + (int)strlen(target_host);
tmp2 = AXIS2_MALLOC(env->allocator,
sizeof(axis2_char_t) * (header_len + 1));
- sprintf(tmp2, "%s%s:%d\r\n", AXIS2_HTTP_HEADER_HOST ": ", listen_host,
+ sprintf(tmp2, "%s%s:%d\r\n", AXIS2_HTTP_HEADER_HOST ": ", target_host,
TCPMON_SESSION_GET_LISTEN_PORT(session, env));
req_header = str_replace(req_header, tmp1, tmp2);
AXIS2_FREE(env->allocator, tmp1);
@@ -1004,7 +1004,7 @@
{
free(str_return);
free(str_tmp);
- return "function str_replace : gimme more memory";
+ return "function str_replace : give me more memory";
}
if (!strcmp(search, replace))
{
@@ -1039,7 +1039,7 @@
}
free(str_tmp);
- free(str);
+ /* free(str); */ /* we are not allocating memory using str */
str_return[addmem] = '\0';
return (str_return);
}
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/util/include/axutil_log.h
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/util/include/axutil_log.h?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/util/include/axutil_log.h (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/util/include/axutil_log.h Thu Jul 3 08:35:44 2008
@@ -234,6 +234,19 @@
# endif
#endif
+#ifndef AXIS2_LOG_PROJECT_PREFIX
+ /** Each module/project should undef and define the following.. */
+#define AXIS2_LOG_PROJECT_PREFIX "[axis2c]"
+#endif
+
+#define AXIS2_LOG_USER_MSG(log, msg) AXIS2_LOG_USER (log, AXIS2_LOG_SI, "%s %s", AXIS2_LOG_PROJECT_PREFIX, msg)
+#define AXIS2_LOG_DEBUG_MSG(log, msg) AXIS2_LOG_DEBUG (log, AXIS2_LOG_SI, "%s %s", AXIS2_LOG_PROJECT_PREFIX, msg)
+#define AXIS2_LOG_INFO_MSG(log, msg) AXIS2_LOG_INFO (log, AXIS2_LOG_SI, "%s %s", AXIS2_LOG_PROJECT_PREFIX, msg)
+#define AXIS2_LOG_WARNING_MSG(log, msg) AXIS2_LOG_WARNING (log, AXIS2_LOG_SI, "%s %s", AXIS2_LOG_PROJECT_PREFIX, msg)
+#define AXIS2_LOG_ERROR_MSG(log, msg) AXIS2_LOG_ERROR (log, AXIS2_LOG_SI, "%s %s", AXIS2_LOG_PROJECT_PREFIX, msg)
+#define AXIS2_LOG_CRITICAL_MSG(log, msg) AXIS2_LOG_CRITICAL (log, AXIS2_LOG_SI, "%s %s", AXIS2_LOG_PROJECT_PREFIX, msg)
+#define AXIS2_LOG_TRACE_MSG(log, msg) AXIS2_LOG_TRACE (log, AXIS2_LOG_SI, "%s %s", AXIS2_LOG_PROJECT_PREFIX, msg)
+
/** @} */
#ifdef __cplusplus
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/util/include/axutil_utils_defines.h
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/util/include/axutil_utils_defines.h?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/util/include/axutil_utils_defines.h (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/util/include/axutil_utils_defines.h Thu Jul 3 08:35:44 2008
@@ -99,7 +99,7 @@
/**
* Exporting
*/
-#if defined(WIN32)
+#if defined(WIN32) && !defined(AXIS2_DECLARE_STATIC)
#define AXIS2_EXPORT __declspec(dllexport)
#else
#define AXIS2_EXPORT
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/util/src/stream.c
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/util/src/stream.c?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/util/src/stream.c (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/util/src/stream.c Thu Jul 3 08:35:44 2008
@@ -621,6 +621,7 @@
int count)
{
int len = 0;
+ int received = 0;
char buffer[2];
if (-1 == stream->socket)
@@ -632,7 +633,22 @@
}
while (len < count)
{
- len += recv(stream->socket, buffer, 1, 0);
+ received = recv(stream->socket, buffer, 1, 0);
+ if (received == 0)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_ERROR, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Socket has being shutdown");
+ return -1;
+ }
+ if (received < 0)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_ERROR, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Error while trying to read the socke");
+ return -1;
+ }
+ len += received;
}
return len;
}
Modified: webservices/axis2/branches/c/post_1_4_mtom/c/xdocs/docs/faq.html
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/c/post_1_4_mtom/c/xdocs/docs/faq.html?rev=673713&r1=673712&r2=673713&view=diff
==============================================================================
--- webservices/axis2/branches/c/post_1_4_mtom/c/xdocs/docs/faq.html (original)
+++ webservices/axis2/branches/c/post_1_4_mtom/c/xdocs/docs/faq.html Thu Jul 3 08:35:44 2008
@@ -40,6 +40,7 @@
SOAP Session management?</a></li>
<li><a href="#faq_2_5">Can I use Axis2/C with
a proxy?</a></li>
+<li><a href="#faq_2_6">Does Axis2/C work on my platform?</a></li>
</ol>
</li>
<li><a href="#3_how_to">How to?</a>
@@ -122,6 +123,13 @@
<h3>2.5 Can I use Axis2/C with a proxy?</h3>
<p>Yes. This requires a few changes to the axis2.xml file.
Information about this can be found in our <a href="http://ws.apache.org/axis2/c/docs/axis2c_manual.html#proxy">documentation</a>.</p>
+<a id="faq_2_6"></a><h3>2.6 Does Axis2/C work on my platform?</h3>
+<p>Currently Axis2/C has been ported to following platforms.<br>
+1. Linux based distributions(Debian, Ubuntu, Redhat Linux etc...,) <br>
+2. Sun Solaris 10(intel) <br>
+3. Mac OS X <br>
+4. Microsoft Windows<br>
+Patches are welcome!
<p style="margin-bottom: 0in;"><br />
</p>