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 sa...@apache.org on 2006/03/08 08:54:59 UTC
svn commit: r384146 - in /webservices/axis2/trunk/c/modules:
core/transport/http/server/apache2/apache2_worker.c
core/transport/http/server/apache2/mod_axis2.c util/log.c
Author: sahan
Date: Tue Mar 7 23:54:57 2006
New Revision: 384146
URL: http://svn.apache.org/viewcvs?rev=384146&view=rev
Log:
Improved Apache2 module
Modified:
webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c
webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c
webservices/axis2/trunk/c/modules/util/log.c
Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c?rev=384146&r1=384145&r2=384146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/apache2_worker.c Tue Mar 7 23:54:57 2006
@@ -26,6 +26,9 @@
#include <axis2_uuid_gen.h>
#include <axis2_conf_init.h>
#include <axis2_apache2_out_transport_info.h>
+#include <axis2_url.h>
+#include <http_core.h>
+#include <http_protocol.h>
/**
* @brief Apahche2 Worker struct impl
@@ -142,6 +145,7 @@
int send_status = -1;
axis2_char_t *content_type = NULL;
axis2_property_t *property = NULL;
+ axis2_url_t *url = NULL;
axis2_http_out_transport_info_t *apache2_out_transport_info = NULL;
AXIS2_ENV_CHECK(env, AXIS2_CRTICAL_FAILURE);
@@ -149,7 +153,9 @@
apache2_worker_impl = AXIS2_INTF_TO_IMPL(apache2_worker);
conf_ctx = apache2_worker_impl->conf_ctx;
-
+ url = axis2_url_create(env, "http",
+ (axis2_char_t*)ap_get_server_name(request),
+ ap_get_server_port(request), request->unparsed_uri);
if(NULL == conf_ctx)
{
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NULL_CONFIGURATION_CONTEXT,
@@ -158,8 +164,8 @@
}
content_length = request->remaining;
http_version = request->protocol;
- req_url = apr_uri_unparse(request->pool, &(request->parsed_uri),
- APR_URI_UNP_OMITUSERINFO);
+ req_url = AXIS2_URL_TO_EXTERNAL_FORM(url, env);
+
content_type = (axis2_char_t*)apr_table_get(request->headers_in,
AXIS2_HTTP_HEADER_CONTENT_TYPE);
request->content_type = content_type;
@@ -186,8 +192,13 @@
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_PROPERTY(msg_ctx, env, AXIS2_TRANSPORT_OUT, out_stream,
- AXIS2_FALSE);
+ property = axis2_property_create(env);
+ AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
+ AXIS2_PROPERTY_SET_FREE_FUNC(property, env, axis2_stream_free_void_arg);
+ AXIS2_PROPERTY_SET_VALUE(property, env, out_stream);
+ AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_TRANSPORT_OUT, property,
+ AXIS2_FALSE);
+
/*AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_TRANSPORT_HEADERS,
axis2_apache2_worker_get_headers(apache2_worker, env,
simple_request), AXIS2_FALSE);*/
@@ -206,6 +217,12 @@
soap_action = (axis2_char_t*)apr_table_get(request->headers_in,
AXIS2_HTTP_HEADER_SOAP_ACTION);
request_body = axis2_stream_create_apache2(env, request);
+ if(NULL == request_body)
+ {
+ AXIS2_LOG_ERROR((*env)->log, AXIS2_LOG_SI, "Error occured in"
+ " creating input stream.");
+ return AXIS2_CRTICAL_FAILURE;
+ }
if(M_GET == request->method_number)
{
processed = axis2_http_transport_utils_process_http_get_request
@@ -284,7 +301,22 @@
body_string = NULL;
}
/*AXIS2_MSG_CTX_FREE(msg_ctx, env);*/
- msg_ctx = NULL;
+ if(NULL != url)
+ {
+ AXIS2_URL_FREE(url, env);
+ url = NULL;
+ }
+ if(NULL != req_url)
+ {
+ AXIS2_FREE((*env)->allocator, req_url);
+ req_url = NULL;
+ }
+ if(NULL != request_body)
+ {
+ AXIS2_STREAM_FREE(request_body, env);
+ request_body = NULL;
+ }
+ msg_ctx = NULL;
return send_status;
}
Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c?rev=384146&r1=384145&r2=384146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/apache2/mod_axis2.c Tue Mar 7 23:54:57 2006
@@ -171,8 +171,8 @@
if(AXIS2_FAILURE == status)
{
fprintf(stderr, "[Axis2] Due to one or more errors mod_axis2 loading"
- "failed. Causing apache2 to stop loading\n");
- /* TODO we should stop apache2 loading */
+ " failed. Causing apache2 to stop loading\n");
+ exit(APEXIT_CHILDFATAL);
}
}
Modified: webservices/axis2/trunk/c/modules/util/log.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/log.c?rev=384146&r1=384145&r2=384146&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/log.c (original)
+++ webservices/axis2/trunk/c/modules/util/log.c Tue Mar 7 23:54:57 2006
@@ -141,7 +141,13 @@
log_impl->stream = axis2_file_handler_open(log_file_name,"a+");
axis2_thread_mutex_unlock(log_impl->mutex);
-
+
+ if(NULL == log_impl->stream)
+ {
+ log_impl->log.ops = NULL;
+ axis2_log_impl_free(allocator, &(log_impl->log));
+ return NULL;
+ }
/* by default, log is enabled */
log_impl->log.enabled = 1;