axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nand...@apache.org
Subject svn commit: r494735 - in /webservices/axis2/trunk/c/modules/core/transport/http/server/IIS: ./ iis_iaspi_plugin_51/
Date Wed, 10 Jan 2007 06:24:43 GMT
Author: nandika
Date: Tue Jan  9 22:24:42 2007
New Revision: 494735

URL: http://svn.apache.org/viewvc?view=rev&rev=494735
Log:
patch of jira 496 applied, thanks to supun

Added:
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_constants.h
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.h
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.h
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.h
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.h
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/iis_iaspi_plugin_51/
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/mod_axis2.def

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_constants.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_constants.h?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_constants.h (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_constants.h Tue Jan  9 22:24:42 2007
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef	AXIS2_IIS_CONSTANTS_H
+#define AXIS2_IIS_CONSTANTS_H
+
+#define INTERNET_MAX_PATH_LENGTH        2048
+#define INTERNET_MAX_SCHEME_LENGTH      32          // longest protocol name length
+#define INTERNET_MAX_URL_LENGTH         (INTERNET_MAX_SCHEME_LENGTH \
+                                        + sizeof("://") \
+                                        + INTERNET_MAX_PATH_LENGTH)
+
+#define URI_MATCHED						1
+#define URI_UN_MATCHED					2
+
+#define EXTENSION_URL					"/axis2/mod_iis.dll\? "
+#define EXTENSION_URL_AXIS2				"/axis2/"
+#define EXTENSION_URL_MODIIS			"mode_iis.dll\? "
+
+
+#define MAX_SERVERNAME					128
+#define MAX_PORT_LEN					8
+
+#define MAX_HTTP_VERSION_LEN			16
+#define MAX_HTTP_CONTENT_TYPE_LEN		2048
+#define MAX_CONTENT_ENCODING_LEN		16
+#define MAX_HTTP_METHOD_LEN				8
+#define MAX_TCP_PORT_LEN				8
+#define MAX_CONTENT_LEN					16
+
+#define OK								200
+#define HTTP_INTERNAL_SERVER_ERROR		500
+#define HTTP_ACCEPTED					202
+
+
+#endif			/*AXIS2_IIS_CONSTANTS_H*/
+

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.c?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.c Tue Jan  9 22:24:42 2007
@@ -0,0 +1,198 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "axis2_iis_out_transport_info.h"
+#include <axis2_string.h>
+#include <axis2_http_transport.h>
+#include <axis2_string.h>
+/**
+ * @brief IIS Out transport info impl structure
+ * Axis2 iis_out_transport_info_impl
+ */
+
+
+typedef struct axis2_iis_out_transport_info_impl
+{
+    axis2_http_out_transport_info_t out_transport_info;    
+    axis2_char_t *encoding;
+	axis2_char_t *content_type;
+}
+
+axis2_iis_out_transport_info_impl_t;
+
+#define AXIS2_INTF_TO_IMPL(out_transport_info) \
+                ((axis2_iis_out_transport_info_impl_t *)(out_transport_info))
+
+axis2_status_t AXIS2_CALL
+axis2_http_out_transport_info_set_content_type(
+    axis2_http_out_transport_info_t *info,
+    const axis2_env_t *env,
+    const axis2_char_t *content_type);
+
+axis2_status_t AXIS2_CALL
+axis2_http_out_transport_info_set_char_encoding(
+    axis2_http_out_transport_info_t *info,
+    const axis2_env_t *env,
+    const axis2_char_t *encoding);
+
+axis2_status_t AXIS2_CALL
+axis2_http_out_transport_info_free(
+    axis2_http_out_transport_info_t *out_transport_info,
+    const axis2_env_t *env);
+
+
+
+axis2_http_out_transport_info_t *AXIS2_CALL
+axis2_iis_out_transport_info_create(
+    const axis2_env_t *env,
+	LPEXTENSION_CONTROL_BLOCK lpECB)
+{
+    axis2_iis_out_transport_info_impl_t *info_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+    info_impl = (axis2_iis_out_transport_info_impl_t *)AXIS2_MALLOC
+            (env->allocator, sizeof(
+                        axis2_iis_out_transport_info_impl_t));
+
+    if (NULL == info_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    info_impl->encoding = NULL;	
+    info_impl->out_transport_info.ops = AXIS2_MALLOC(env->allocator,
+            sizeof(axis2_http_out_transport_info_ops_t));
+    if (NULL == info_impl->out_transport_info.ops)
+    {
+        axis2_http_out_transport_info_free((axis2_http_out_transport_info_t *)
+                info_impl, env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    info_impl->out_transport_info.ops->set_content_type =
+        axis2_http_out_transport_info_set_content_type;
+    info_impl->out_transport_info.ops->set_char_encoding =
+        axis2_http_out_transport_info_set_char_encoding;
+    info_impl->out_transport_info.ops->free =
+        axis2_http_out_transport_info_free;
+
+    return &(info_impl->out_transport_info);
+}
+
+axis2_status_t AXIS2_CALL
+axis2_http_out_transport_info_free(
+    axis2_http_out_transport_info_t *info,
+    const axis2_env_t *env)
+{
+    axis2_iis_out_transport_info_impl_t *info_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    info_impl = AXIS2_INTF_TO_IMPL(info);
+
+     if (info_impl->encoding)
+    {
+        AXIS2_FREE(env->allocator, info_impl->encoding);
+        info_impl->encoding = NULL;
+    }
+    if (info->ops)
+        AXIS2_FREE(env->allocator, info->ops);
+
+    AXIS2_FREE(env->allocator, info_impl);
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_iis_out_transport_info_free_void_arg(
+    void *transport_info,
+    const axis2_env_t *env)
+{
+    axis2_http_out_transport_info_t *transport_info_l = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    transport_info_l = (axis2_http_out_transport_info_t *) transport_info;
+    return axis2_http_out_transport_info_free(transport_info_l, env);
+}
+
+axis2_status_t AXIS2_CALL
+axis2_http_out_transport_info_set_content_type(
+    axis2_http_out_transport_info_t *info,
+    const axis2_env_t *env,
+    const axis2_char_t *content_type)
+{
+    axis2_char_t *tmp1 = NULL;
+    axis2_char_t *tmp2 = NULL;
+	axis2_char_t *tmp3 = NULL;
+	axis2_char_t *tmp4 = NULL;
+    axis2_iis_out_transport_info_impl_t *info_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, content_type, AXIS2_FAILURE);
+
+    info_impl = AXIS2_INTF_TO_IMPL(info);
+
+    if (info_impl->encoding)
+    {
+        tmp1 = AXIS2_STRACAT(info_impl->content_type, content_type, env);
+		tmp2 = AXIS2_STRACAT(tmp1, ";charset:", env);
+		tmp3 = AXIS2_STRACAT(tmp2, info_impl->encoding, env);
+		//tmp4 = AXIS2_STRACAT(tmp3, "", env);
+		info_impl->content_type = AXIS2_STRDUP(tmp3, env);
+
+		AXIS2_FREE(env->allocator, tmp1);
+        AXIS2_FREE(env->allocator, tmp2);
+		AXIS2_FREE(env->allocator, tmp3);
+		AXIS2_FREE(env->allocator, tmp4);
+    }
+    else
+    {
+		info_impl->content_type = AXIS2_STRDUP(content_type, env);
+    }
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+axis2_http_out_transport_info_set_char_encoding(
+    axis2_http_out_transport_info_t *info,
+    const axis2_env_t *env,
+    const axis2_char_t *encoding)
+{
+    axis2_iis_out_transport_info_impl_t *info_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, encoding, AXIS2_FAILURE);
+
+    info_impl = AXIS2_INTF_TO_IMPL(info);
+
+    if (info_impl->encoding)
+    {
+        AXIS2_FREE(env->allocator, info_impl->encoding);
+    }
+    info_impl->encoding = AXIS2_STRDUP(encoding, env);
+
+    return AXIS2_SUCCESS;
+}
+
+axis2_char_t *axis2_http_out_transport_get_content(axis2_http_out_transport_info_t *info)
+{
+	axis2_iis_out_transport_info_impl_t *info_impl = NULL;
+	info_impl = AXIS2_INTF_TO_IMPL(info);
+	return info_impl->content_type;
+}
+
+
+
+

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.h?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.h (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_out_transport_info.h Tue Jan  9 22:24:42 2007
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_IIS_OUT_TRANSPORT_INFO_H
+#define AXIS2_IIS_OUT_TRANSPORT_INFO_H
+
+/** 
+ * @ingroup axis2_core_transport_http
+ * @{
+ */
+
+/**
+ * @file axis2_iis_out_transport_info.h
+ * @brief axis2 IIS Out Transport Info
+ */
+
+#include <axis2_http_out_transport_info.h>
+#include <httpext.h>
+#ifdef __cplusplus
+extern "C" 
+{
+#endif
+
+axis2_http_out_transport_info_t *AXIS2_CALL 
+axis2_iis_out_transport_info_create(
+    const axis2_env_t *env,
+	LPEXTENSION_CONTROL_BLOCK lpECB);
+
+/**
+ * Free http_out_transport_info passed as void pointer. This will be
+ * cast into appropriate type and then pass the cast object
+ * into the http_out_transport_info structure's free method
+ */
+axis2_status_t AXIS2_CALL 
+axis2_iis_out_transport_info_free_void_arg(
+    void *transport_info,
+    const axis2_env_t *env);
+
+axis2_char_t *axis2_http_out_transport_get_content(axis2_http_out_transport_info_t *out_transport_info);
+
+#ifdef __cplusplus
+}
+#endif
+#endif	/* AXIS2_IIS_OUT_TRANSPORT_INFO_H */

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.c?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.c Tue Jan  9 22:24:42 2007
@@ -0,0 +1,322 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include "axis2_iis_stream.h"
+#include <httpext.h>
+
+/**
+ * @brief Stream struct impl
+ * Streaming mechanisms for iis web server
+ */
+
+typedef struct iis_stream_impl
+{
+    axis2_stream_t stream;
+    axis2_stream_type_t stream_type;
+    LPEXTENSION_CONTROL_BLOCK lpECB;
+	unsigned int cur_pos;
+	void *cur_position;
+}
+iis_stream_impl_t;
+
+
+#define AXIS2_INTF_TO_IMPL(stream) ((iis_stream_impl_t *)(stream))
+
+axis2_status_t AXIS2_CALL
+iis_stream_free(
+    axis2_stream_t *stream,
+    const axis2_env_t *env);
+
+axis2_stream_type_t AXIS2_CALL
+iis_stream_get_type(
+    axis2_stream_t *stream,
+    const axis2_env_t *env);
+
+int AXIS2_CALL
+iis_stream_write(
+    axis2_stream_t *stream,
+    const axis2_env_t *env,
+    const void *buffer,
+    size_t count);
+
+int AXIS2_CALL
+iis_stream_read(
+    axis2_stream_t *stream,
+    const axis2_env_t *env,
+    void *buffer,
+    size_t count);
+
+int AXIS2_CALL
+iis_stream_skip(
+    axis2_stream_t *stream,
+    const axis2_env_t *env,
+    int count);
+
+int AXIS2_CALL
+iis_stream_get_char(
+    axis2_stream_t *stream,
+    const axis2_env_t *env);
+
+
+axis2_stream_t * AXIS2_CALL
+axis2_stream_create_iis(
+    const axis2_env_t *env,
+    LPEXTENSION_CONTROL_BLOCK lpECB)
+{
+    iis_stream_impl_t *stream_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK(env->error, lpECB, NULL);
+
+    stream_impl = (iis_stream_impl_t *)AXIS2_MALLOC(
+                env->allocator, sizeof(iis_stream_impl_t));
+
+    if (NULL == stream_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+	stream_impl->cur_pos = 0;
+	stream_impl->cur_position = NULL;
+    stream_impl->lpECB = lpECB;
+    stream_impl->stream_type = AXIS2_STREAM_MANAGED;
+    stream_impl->stream.ops = (axis2_stream_ops_t *) AXIS2_MALLOC(
+                env->allocator, sizeof(axis2_stream_ops_t));
+    if (NULL == stream_impl->stream.ops)
+    {
+        iis_stream_free(&(stream_impl->stream), env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    stream_impl->stream.ops->free_fn = iis_stream_free;
+    stream_impl->stream.ops->read = iis_stream_read;
+    stream_impl->stream.ops->write = iis_stream_write;
+    stream_impl->stream.ops->skip = iis_stream_skip;
+
+    return &(stream_impl->stream);
+}
+
+axis2_status_t AXIS2_CALL
+iis_stream_free(
+    axis2_stream_t *stream,
+    const axis2_env_t *env)
+{
+    iis_stream_impl_t *stream_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    stream_impl = AXIS2_INTF_TO_IMPL(stream);
+    if (stream_impl->stream.ops)
+    {
+        AXIS2_FREE(env->allocator, stream_impl->stream.ops);
+    }
+    AXIS2_FREE(env->allocator, stream_impl);
+
+    return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+iis_stream_read(
+    axis2_stream_t *stream,
+    const axis2_env_t *env,
+    void *buffer,
+    size_t count)
+{
+	void *temp_buff = NULL;
+	unsigned int data_to_read = 0;
+	int i = 0;
+	DWORD ret_val = TRUE;
+	DWORD read_bytes = (DWORD)count;
+    iis_stream_impl_t *stream_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
+    stream_impl = (iis_stream_impl_t *)stream;
+
+	if (stream_impl->cur_pos == 0)
+		stream_impl->cur_position = stream_impl->lpECB->lpbData;
+
+	// If this is the case all the bytes are in the lpECB->lpbData buffer
+	if (stream_impl->lpECB->cbAvailable == stream_impl->lpECB->cbTotalBytes)
+	{	
+		// Cannot read more than in the buffer.
+		if (count + stream_impl->cur_pos <= stream_impl->lpECB->cbAvailable)
+			data_to_read = (unsigned)count;
+		else
+			data_to_read = stream_impl->lpECB->cbAvailable - stream_impl->cur_pos;
+
+		memcpy(buffer, stream_impl->cur_position, data_to_read);
+		(char *)stream_impl->cur_position += data_to_read;
+		stream_impl->cur_pos += data_to_read;
+		read_bytes = data_to_read;
+	}
+	else if (stream_impl->lpECB->cbAvailable == -1)
+	{
+		ret_val = stream_impl->lpECB->ReadClient(stream_impl->lpECB->ConnID, buffer, &read_bytes);		
+	}
+	else if (stream_impl->lpECB->cbAvailable < stream_impl->lpECB->cbTotalBytes)
+	{
+		if (stream_impl->cur_pos > stream_impl->lpECB->cbAvailable)
+		{
+			ret_val = stream_impl->lpECB->ReadClient(stream_impl->lpECB->ConnID, buffer, &read_bytes);		
+		} 
+		else if (stream_impl->cur_pos + count > stream_impl->lpECB->cbAvailable && stream_impl->cur_pos < stream_impl->lpECB->cbAvailable) 
+		{
+			data_to_read = stream_impl->lpECB->cbAvailable - stream_impl->cur_pos;		
+			memcpy(buffer, stream_impl->cur_position, data_to_read);
+			
+			read_bytes = stream_impl->cur_pos + count - stream_impl->lpECB->cbAvailable;			
+			temp_buff = malloc(read_bytes);
+			
+			if (temp_buff == NULL) return data_to_read;
+
+			ret_val = stream_impl->lpECB->ReadClient(stream_impl->lpECB->ConnID, temp_buff, &read_bytes);					
+			memcpy(((char *)buffer + data_to_read + 1), temp_buff, read_bytes);
+			read_bytes += data_to_read;
+		}
+		else 
+		{									
+			memcpy(buffer, stream_impl->cur_position, count);
+			(char *)stream_impl->cur_position += count;
+			stream_impl->cur_pos += (unsigned)count;
+			read_bytes = (int)count;	
+		}
+	}
+	if (ret_val == TRUE)
+		return read_bytes;
+	else
+		return -1;
+}
+
+int AXIS2_CALL
+iis_stream_write(
+    axis2_stream_t *stream,
+    const axis2_env_t *env,
+    const void *buf,
+    size_t count)
+{
+	DWORD ret_val = NO_ERROR;
+	unsigned bytes_sent = 0;
+    iis_stream_impl_t *stream_impl = NULL;
+    axis2_char_t *buffer = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, buf, AXIS2_FAILURE);
+    stream_impl = AXIS2_INTF_TO_IMPL(stream);
+    buffer = (axis2_char_t*)buf;
+	bytes_sent = (unsigned)strlen(buffer);
+    if (count <= 0)
+    {
+        return (int)count;
+    }
+    /* assume that buffer is not null terminated */
+    ret_val = stream_impl->lpECB->WriteClient(stream_impl->lpECB->ConnID, buffer, &bytes_sent, HSE_IO_SYNC); 
+	if (ret_val == TRUE)
+		return bytes_sent;
+	else
+		return -1;
+}
+
+int AXIS2_CALL
+iis_stream_skip(
+    axis2_stream_t *stream,
+    const axis2_env_t *env,
+    int count)
+{
+	DWORD ret_val = TRUE;	
+    iis_stream_impl_t *stream_impl = NULL;
+   	void *temp_buff = NULL;
+	int data_to_read = 0;
+	int i = 0;	
+	DWORD read_bytes = (DWORD)count;
+	AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
+	stream_impl = (iis_stream_impl_t *)stream;
+
+    if (stream_impl->cur_pos == 0)
+		stream_impl->cur_position = stream_impl->lpECB->lpbData;
+
+	if (stream_impl->lpECB->cbAvailable == stream_impl->lpECB->cbTotalBytes)
+	{		
+		if (count + stream_impl->cur_pos <= stream_impl->lpECB->cbAvailable)
+			data_to_read = count;
+		else
+			data_to_read = stream_impl->lpECB->cbAvailable - stream_impl->cur_pos;
+		
+		(char *)stream_impl->cur_position += data_to_read;
+		stream_impl->cur_pos += data_to_read;
+		read_bytes = data_to_read;
+	}
+	else if (stream_impl->lpECB->cbAvailable == -1)
+	{
+		temp_buff = malloc(read_bytes);
+		ret_val = stream_impl->lpECB->ReadClient(stream_impl->lpECB->ConnID, temp_buff, &read_bytes);		
+		free(temp_buff);
+	}
+	else if (stream_impl->lpECB->cbAvailable < stream_impl->lpECB->cbTotalBytes)
+	{
+		if (stream_impl->cur_pos > stream_impl->lpECB->cbAvailable)
+		{
+			temp_buff = malloc(read_bytes);
+			ret_val = stream_impl->lpECB->ReadClient(stream_impl->lpECB->ConnID, temp_buff, &read_bytes);		
+			free(temp_buff);
+		} 
+		else if (stream_impl->cur_pos + count > stream_impl->lpECB->cbAvailable && stream_impl->cur_pos < stream_impl->lpECB->cbAvailable) 
+		{
+			data_to_read = stream_impl->lpECB->cbAvailable - stream_impl->cur_pos;							
+			read_bytes = stream_impl->cur_pos + count - stream_impl->lpECB->cbAvailable;			
+			temp_buff = malloc(read_bytes);
+			
+			if (temp_buff == NULL) return data_to_read;
+
+			ret_val = stream_impl->lpECB->ReadClient(stream_impl->lpECB->ConnID, temp_buff, &read_bytes);							
+			read_bytes += data_to_read;
+			free(temp_buff);
+		}
+		else 
+		{									
+			(char *)stream_impl->cur_position += count;
+			stream_impl->cur_pos += count;
+			read_bytes = count;	
+		}
+	}	
+	if (ret_val == FALSE)
+	{
+		return -1;
+	}    
+    return read_bytes;
+}
+
+int AXIS2_CALL
+iis_stream_get_char(
+    axis2_stream_t *stream,
+    const axis2_env_t *env)
+{
+    int ret = -1;
+    AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
+
+    return ret;
+}
+
+axis2_stream_type_t AXIS2_CALL
+iis_stream_get_type(
+    axis2_stream_t *stream,
+    const axis2_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
+    return AXIS2_INTF_TO_IMPL(stream)->stream_type;
+}
+
+
+

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.h?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.h (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_stream.h Tue Jan  9 22:24:42 2007
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef IIS_STREAM_H
+#define IIS_STREAM_H
+
+#include <axis2_const.h>
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axis2_stream.h>
+#include <httpext.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/** brief Constructor for creating IIS stream
+  * @return axis2_stream (IIS)
+  */
+axis2_stream_t * AXIS2_CALL axis2_stream_create_iis
+                        (const axis2_env_t *env, 
+						LPEXTENSION_CONTROL_BLOCK lpECB);
+    
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* IIS_STREAM_H */
\ No newline at end of file

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.c?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.c Tue Jan  9 22:24:42 2007
@@ -0,0 +1,608 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <axis2_http_transport.h>
+#include <axis2_conf.h>
+#include <axis2_string.h>
+#include <axis2_msg_ctx.h>
+#include <axis2_http_out_transport_info.h>
+#include <axis2_http_transport_utils.h>
+#include <axis2_op_ctx.h>
+#include <axis2_engine.h>
+#include <axis2_uuid_gen.h>
+#include <axis2_conf_init.h>
+#include <axis2_url.h>
+
+#include "axis2_iis_out_transport_info.h"
+#include "axis2_iis_stream.h"
+#include "axis2_iis_worker.h"
+
+// Files from iis
+#include <httpfilt.h>
+#include <httpext.h>
+
+#include "axis2_iis_constants.h"
+
+#define READ_SIZE  32
+
+typedef struct axis2_iis_worker_impl
+{
+    axis2_iis_worker_t iis_worker;
+    axis2_conf_ctx_t *conf_ctx;
+}
+axis2_iis_worker_impl_t;
+
+
+#define AXIS2_INTF_TO_IMPL(iis_worker) ((axis2_iis_worker_impl_t *)\
+                        (iis_worker))
+int AXIS2_CALL
+axis2_iis_worker_process_request(
+    axis2_iis_worker_t *iis_worker,
+    const axis2_env_t *env,
+    LPEXTENSION_CONTROL_BLOCK lpECB);
+
+axis2_char_t *AXIS2_CALL
+axis2_iis_worker_get_bytes(
+    const axis2_env_t *env,
+    axis2_stream_t *stream);
+
+axis2_status_t AXIS2_CALL
+axis2_iis_worker_free(
+    axis2_iis_worker_t *iis_worker,
+    const axis2_env_t *env);
+
+axis2_status_t axis2_worker_get_original_url(char url[], char ret_url[]);
+axis2_status_t write_response(LPEXTENSION_CONTROL_BLOCK lpECB, const void *b, unsigned int l);
+axis2_status_t start_response(LPEXTENSION_CONTROL_BLOCK lpECB,
+                                    int status,
+                                    const char *reason,
+                                    const char *const *header_names,
+                                    const char *const *header_values,
+                                    unsigned int num_of_headers);
+char *status_reason(int status);
+
+axis2_iis_worker_t * AXIS2_CALL
+axis2_iis_worker_create(
+    const axis2_env_t *env, 
+    axis2_char_t *repo_path)
+{
+    axis2_iis_worker_impl_t *iis_worker_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    iis_worker_impl = (axis2_iis_worker_impl_t *)
+            AXIS2_MALLOC(env->allocator, sizeof(axis2_iis_worker_impl_t));
+
+    if (NULL == iis_worker_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    iis_worker_impl->iis_worker.ops = NULL;
+    iis_worker_impl->conf_ctx = build_conf_ctx(env, repo_path);
+
+    if (NULL == iis_worker_impl->conf_ctx)
+    {
+        axis2_iis_worker_free((axis2_iis_worker_t *)iis_worker_impl,
+                env);
+        return NULL;
+    }
+    iis_worker_impl->iis_worker.ops = AXIS2_MALLOC(env->allocator,
+            sizeof(axis2_iis_worker_ops_t));
+
+    if (NULL == iis_worker_impl->iis_worker.ops)
+    {
+        axis2_iis_worker_free((axis2_iis_worker_t *)iis_worker_impl,
+                env);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+	// Set the operations to the functions
+    iis_worker_impl->iis_worker.ops->process_request =
+        axis2_iis_worker_process_request;
+    iis_worker_impl->iis_worker.ops->free = axis2_iis_worker_free;
+
+    return &(iis_worker_impl->iis_worker);	
+}
+
+axis2_status_t AXIS2_CALL
+axis2_iis_worker_free(
+    axis2_iis_worker_t *iis_worker,
+    const axis2_env_t *env)
+{
+    axis2_iis_worker_impl_t *worker_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    worker_impl = AXIS2_INTF_TO_IMPL(iis_worker);
+    if (worker_impl->conf_ctx)
+    {
+        AXIS2_CONF_CTX_FREE(worker_impl->conf_ctx, env);
+        worker_impl->conf_ctx = NULL;
+    }
+
+    if (iis_worker->ops)
+        AXIS2_FREE(env->allocator, iis_worker->ops);
+
+    AXIS2_FREE(env->allocator, worker_impl->conf_ctx);
+
+    return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+axis2_iis_worker_process_request(
+    axis2_iis_worker_t *iis_worker,
+    const axis2_env_t *env,
+    LPEXTENSION_CONTROL_BLOCK lpECB)
+{
+	axis2_iis_worker_impl_t *iis_worker_impl = NULL;
+    axis2_conf_ctx_t *conf_ctx = NULL;
+    axis2_msg_ctx_t *msg_ctx = NULL;
+    axis2_stream_t *request_body = NULL;
+    axis2_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;
+    axis2_char_t *ctx_written = NULL;
+    //int content_length = -1;
+    axis2_op_ctx_t *op_ctx = NULL;
+    axis2_char_t *req_url = NULL;
+    axis2_char_t *body_string = NULL;
+    int send_status = -1;
+    axis2_property_t *property = NULL;
+    axis2_url_t *url = NULL;
+    axis2_http_out_transport_info_t *iis_out_transport_info = NULL;
+    axis2_qname_t *transport_qname = NULL;
+    axis2_char_t *ctx_uuid = NULL;
+
+	axis2_char_t http_version[MAX_HTTP_VERSION_LEN];
+    axis2_char_t soap_action[INTERNET_MAX_URL_LENGTH];
+	axis2_char_t content_type[MAX_HTTP_CONTENT_TYPE_LEN];
+	axis2_char_t encoding_header_value[MAX_CONTENT_ENCODING_LEN];
+	axis2_char_t http_method[MAX_HTTP_METHOD_LEN];
+	axis2_char_t content_length[MAX_CONTENT_LEN];
+	axis2_char_t original_url[INTERNET_MAX_URL_LENGTH];
+
+	char readBytes[10000];
+	int content_length_int = 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];
+
+	// Check the parameters
+    AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, lpECB, AXIS2_CRITICAL_FAILURE);
+
+	iis_worker_impl = AXIS2_INTF_TO_IMPL(iis_worker);
+	conf_ctx = iis_worker_impl->conf_ctx;	
+
+	if (NULL == conf_ctx)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NULL_CONFIGURATION_CONTEXT,
+                AXIS2_FAILURE);
+        return AXIS2_CRITICAL_FAILURE;
+    }	
+	// TODO check for errors
+	cbSize = INTERNET_MAX_PATH_LENGTH; 
+	ret_val = lpECB->GetServerVariable(lpECB->ConnID, 
+                         "SERVER_NAME", 
+                         server_name, 
+                         &cbSize); 	
+
+	cbSize = MAX_TCP_PORT_LEN;
+	ret_val = lpECB->GetServerVariable(lpECB->ConnID, "SERVER_PORT", port, &cbSize);
+
+	cbSize = INTERNET_MAX_PATH_LENGTH;
+	ret_val = lpECB->GetServerVariable(lpECB->ConnID, "HTTP_URL", redirect_url, &cbSize);
+
+	axis2_worker_get_original_url(redirect_url, original_url);
+	// create the url using the above variables
+	url = axis2_url_create(env, "http",
+						server_name, 
+						atoi(port), 
+						original_url);								
+
+	cbSize = MAX_CONTENT_LEN;
+	ret_val = lpECB->GetServerVariable(lpECB->ConnID, "CONTENT_LENGTH", content_length, &cbSize);
+	
+	// Retrive the http version as a string e.g HTTP/1.1
+	cbSize = MAX_HTTP_VERSION_LEN;
+	ret_val = lpECB->GetServerVariable(lpECB->ConnID, "HTTP_VERSION", http_version, &cbSize);
+
+	req_url = AXIS2_URL_TO_EXTERNAL_FORM(url, env);			
+		
+	// Retrieve the http content type as a string e.g GET or POST 
+	cbSize = MAX_HTTP_CONTENT_TYPE_LEN;
+	ret_val = lpECB->GetServerVariable(lpECB->ConnID, "CONTENT_TYPE", content_type, &cbSize);
+	
+	// Retrieve the encoding of the http request
+	cbSize = MAX_CONTENT_ENCODING_LEN;
+	ret_val = lpECB->GetServerVariable(lpECB->ConnID, "CONTENT_ENCODING", encoding_header_value, &cbSize);  
+
+    out_stream = axis2_stream_create_basic(env);	
+    transport_qname = axis2_qname_create(env, AXIS2_TRANSPORT_HTTP, NULL,
+            NULL);
+    out_desc = AXIS2_CONF_GET_TRANSPORT_OUT(AXIS2_CONF_CTX_GET_CONF
+            (iis_worker_impl->conf_ctx, env), env,
+            transport_qname);
+    in_desc = AXIS2_CONF_GET_TRANSPORT_IN(AXIS2_CONF_CTX_GET_CONF
+            (iis_worker_impl->conf_ctx, env), env,
+            transport_qname);
+    AXIS2_QNAME_FREE(transport_qname, env);
+
+	msg_ctx = axis2_msg_ctx_create(env, conf_ctx, in_desc, out_desc);
+    AXIS2_MSG_CTX_SET_SERVER_SIDE(msg_ctx, env, AXIS2_TRUE);
+
+    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);
+
+	ctx_uuid = axis2_uuid_gen(env);
+    AXIS2_MSG_CTX_SET_SVC_GRP_CTX_ID(msg_ctx, env, ctx_uuid);
+    AXIS2_FREE(env->allocator, ctx_uuid);
+
+    property = axis2_property_create(env);	
+    AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
+    AXIS2_PROPERTY_SET_FREE_FUNC(property, env,
+            axis2_iis_out_transport_info_free_void_arg);
+    iis_out_transport_info = axis2_iis_out_transport_info_create(env, lpECB);
+    AXIS2_PROPERTY_SET_VALUE(property, env, iis_out_transport_info);
+    AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_HTTP_OUT_TRANSPORT_INFO,
+            property, AXIS2_FALSE);
+
+	
+	cbSize = INTERNET_MAX_URL_LENGTH;
+	ret_val = lpECB->GetServerVariable(lpECB->ConnID, AXIS2_HTTP_HEADER_SOAP_ACTION, soap_action, &cbSize);
+	request_body = axis2_stream_create_iis(env, lpECB);
+	//request_body->ops->read(request_body, env, readBytes, content_length_int);
+	if (NULL == request_body)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error occured in"
+                " creating input stream.");
+        return AXIS2_CRITICAL_FAILURE;
+    }
+	
+	cbSize = MAX_HTTP_METHOD_LEN;
+	ret_val = lpECB->GetServerVariable(lpECB->ConnID, "HTTP_METHOD", http_method, &cbSize);
+		
+	if (stricmp(http_method, "GET") == 0)
+    {
+        processed = axis2_http_transport_utils_process_http_get_request
+                (env, msg_ctx, request_body, out_stream,
+                        content_type , soap_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);
+            iis_out_transport_info->ops->set_content_type(iis_out_transport_info, env, "text/html");
+            send_status = OK;
+        }
+    }
+    else if (stricmp(http_method, "POST") == 0)
+    {
+        axis2_status_t status = AXIS2_FAILURE;
+		content_length_int = atoi(content_length);
+        status = axis2_http_transport_utils_process_http_post_request
+                (env, msg_ctx, request_body, out_stream,
+                        content_type , content_length_int,
+                        soap_action,
+                        (axis2_char_t *)req_url);
+
+		// generate a soap fault and send it
+        if (status == AXIS2_FAILURE)
+        {
+            axis2_msg_ctx_t *fault_ctx = NULL;
+            axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
+            if (NULL == engine)
+            {
+                send_status =  HTTP_INTERNAL_SERVER_ERROR;
+            }
+            fault_ctx = AXIS2_ENGINE_CREATE_FAULT_MSG_CTX(engine, env, msg_ctx);
+            AXIS2_ENGINE_SEND_FAULT(engine, env, fault_ctx);
+            body_string = axis2_iis_worker_get_bytes(env, out_stream);
+            send_status =  HTTP_INTERNAL_SERVER_ERROR;
+            AXIS2_MSG_CTX_FREE(fault_ctx, env);
+        }
+    }
+	// Nothing wrong has happen. So proceed with the request
+    if (-1 == send_status)
+    {
+        op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env);
+        if (op_ctx)
+        {
+            axis2_ctx_t *ctx = AXIS2_OP_CTX_GET_BASE(AXIS2_MSG_CTX_GET_OP_CTX(
+                        msg_ctx, env), env);
+            if (ctx)
+            {
+                property = AXIS2_CTX_GET_PROPERTY(ctx, env,
+                        AXIS2_RESPONSE_WRITTEN, AXIS2_FALSE);
+                if (property)
+                {
+                    ctx_written = AXIS2_PROPERTY_GET_VALUE(property, env);
+                    property = NULL;
+                }
+            }
+        }
+        if (ctx_written && AXIS2_STRCASECMP(ctx_written, "TRUE") == 0)
+        {
+            send_status = OK;
+            body_string = axis2_iis_worker_get_bytes(env, out_stream);
+        }
+        else
+        {
+            send_status = HTTP_ACCEPTED;
+        }
+    }
+
+	if (body_string)
+	{		
+		const char *headers_names[] = {
+					"Content-Type",
+					"Content-Length"
+					};
+		const char *headers_vhtml[2];
+					
+		headers_vhtml[1] = (char *)malloc(16);
+		headers_vhtml[0] = axis2_http_out_transport_get_content(iis_out_transport_info);
+		sprintf(headers_vhtml[1], "%d", strlen(body_string));
+		if(!start_response(lpECB, send_status, NULL, headers_names, headers_vhtml, 2))
+		{
+			
+		}
+
+		cbSize = strlen(body_string);
+		if(!write_response(lpECB, body_string, cbSize))
+		{
+
+		}
+        AXIS2_FREE(env->allocator, body_string);
+        body_string = NULL;
+    }
+    if (url)
+    {
+        AXIS2_URL_FREE(url, env);
+        url = NULL;
+    }
+    if (req_url)
+    {
+        AXIS2_FREE(env->allocator, req_url);
+        req_url = NULL;
+    }
+    if (request_body)
+    {
+        AXIS2_STREAM_FREE(request_body, env);
+        request_body = NULL;
+    }
+    msg_ctx = NULL;
+    return send_status;
+}
+
+axis2_status_t write_response(LPEXTENSION_CONTROL_BLOCK lpECB, const void *b, unsigned int l)
+{    
+    if (lpECB && b) {
+        if (l) {
+            unsigned int written = 0;
+            char *buf = (char *)b;
+			// If couldn't write the data at onece try again until all the data is written.
+            while (written < l) {
+                DWORD try_to_write = l - written;
+                if (!lpECB->WriteClient(lpECB->ConnID,
+                                           buf + written, &try_to_write, 0)) {
+                    return FALSE;
+                }
+                written += try_to_write;
+            }
+        }        
+        return TRUE;
+    }    
+    return FALSE;
+}
+
+axis2_status_t start_response(LPEXTENSION_CONTROL_BLOCK lpECB,
+                                    int status,
+                                    const char *reason,
+                                    const char *const *header_names,
+                                    const char *const *header_values,
+                                    unsigned int num_of_headers)
+{
+    static char crlf[3] = { (char)13, (char)10, '\0' };
+    
+    if (status < 100 || status > 1000) {        
+        return FALSE;
+    }
+
+    if (lpECB) {
+        size_t len_of_status;
+        char *status_str;
+        char *headers_str;
+
+        /*
+         * Create the status line
+         */
+        if (!reason) {
+            reason = status_reason(status);
+        }
+        status_str = (char *)_alloca((6 + strlen(reason)) * sizeof(char));
+        sprintf(status_str, "%d %s", status, reason);
+        len_of_status = strlen(status_str);
+
+        /*
+         * Create response headers string
+         */
+        if (num_of_headers) {
+            size_t i, len_of_headers;
+            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]);
+                len_of_headers += 4;        /* extra for colon, space and crlf */
+            }
+
+            len_of_headers += 3;    /* crlf and terminating null char */
+            headers_str = (char *)_alloca(len_of_headers * sizeof(char));
+            headers_str[0] = '\0';
+
+            for (i = 0; i < num_of_headers; i++) {
+                strcat(headers_str, header_names[i]);
+                strcat(headers_str, ": ");
+                strcat(headers_str, header_values[i]);
+                strcat(headers_str, "\r\n");
+            }
+            strcat(headers_str, "\r\n");
+        }
+        else {
+            headers_str = crlf;
+        }
+
+        if (!lpECB->ServerSupportFunction(lpECB->ConnID,
+                                             HSE_REQ_SEND_RESPONSE_HEADER,
+                                             status_str,
+                                             (LPDWORD) &len_of_status,
+                                             (LPDWORD) headers_str)) {            
+            return FALSE;
+        }
+        return TRUE;
+    }
+    return FALSE;
+}
+
+char *status_reason(int status)
+{
+    static struct reasons {
+        int status;
+        char *reason;
+    } *r, reasons[] = {
+        { 100, "Continue" },
+        { 101, "Switching Protocols" },
+        { 200, "OK" },
+        { 201, "Created" },
+        { 202, "Accepted" },
+        { 203, "Non-Authoritative Information" },
+        { 204, "No Content" },
+        { 205, "Reset Content" },
+        { 206, "Partial Content" },
+        { 300, "Multiple Choices" },
+        { 301, "Moved Permanently" },
+        { 302, "Moved Temporarily" },
+        { 303, "See Other" },
+        { 304, "Not Modified" },
+        { 305, "Use Proxy" },
+        { 400, "Bad Request" },
+        { 401, "Unauthorized" },
+        { 402, "Payment Required" },
+        { 403, "Forbidden" },
+        { 404, "Not Found" },
+        { 405, "Method Not Allowed" },
+        { 406, "Not Acceptable" },
+        { 407, "Proxy Authentication Required" },
+        { 408, "Request Timeout" },
+        { 409, "Conflict" },
+        { 410, "Gone" },
+        { 411, "Length Required" },
+        { 412, "Precondition Failed" },
+        { 413, "Request Entity Too Large" },
+        { 414, "Request-URI Too Long" },
+        { 415, "Unsupported Media Type" },
+        { 500, "Internal Server Error" },
+        { 501, "Not Implemented" },
+        { 502, "Bad Gateway" },
+        { 503, "Service Unavailable" },
+        { 504, "Gateway Timeout" },
+        { 505, "HTTP Version Not Supported" },
+        { 000, NULL}
+    };
+
+    r = reasons;
+    while (r->status <= status)
+        if (r->status == status)
+            return r->reason;
+        else
+            r++;
+    return "No Reason";
+}
+
+axis2_status_t axis2_worker_get_original_url(char url[], char ret_url[])
+{
+	int i = 0;
+	for (i = 0; i < 7 ; i++)
+		ret_url[i] = url[i];
+
+	for (i = 7; url[i] != '\0'; i++)
+		ret_url[i] = url[i + 12];
+
+	ret_url[i] = '\0';
+		
+	return URI_MATCHED;
+}
+
+axis2_char_t *AXIS2_CALL
+axis2_iis_worker_get_bytes(
+    const axis2_env_t *env,
+    axis2_stream_t *stream)
+{
+
+    axis2_stream_t *tmp_stream = NULL;
+    int return_size = -1;
+    axis2_char_t *buffer = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK(env->error, stream, NULL);
+
+    tmp_stream = axis2_stream_create_basic(env);
+    while (1)
+    {
+        int read = 0;
+        int write = 0;
+
+        char buf[READ_SIZE];
+        read = AXIS2_STREAM_READ(stream, env, buf, READ_SIZE);
+        if (read < 0)
+        {
+            break;
+        }
+        write = AXIS2_STREAM_WRITE(tmp_stream, env, buf, read);
+        if (read < (READ_SIZE - 1))
+        {
+            break;
+        }
+    }
+    return_size = AXIS2_STREAM_BASIC_GET_LEN(tmp_stream, env);
+
+    if (return_size > 0)
+    {
+        buffer = (char *)AXIS2_MALLOC(env->allocator, sizeof(char) *
+                (return_size + 2));
+        return_size = AXIS2_STREAM_READ(tmp_stream, env, buffer,
+                return_size + 1);
+        buffer[return_size + 1] = '\0';
+    }
+    AXIS2_STREAM_FREE(tmp_stream, env);
+    return buffer;
+}
+
+

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.h?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.h (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_iis_worker.h Tue Jan  9 22:24:42 2007
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_APACHE2_WORKER_H
+#define AXIS2_APACHE2_WORKER_H
+
+#include <axis2_const.h>
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axis2_conf_ctx.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct axis2_iis_worker_ops axis2_iis_worker_ops_t;
+typedef struct axis2_iis_worker axis2_iis_worker_t;
+	
+struct axis2_iis_worker_ops
+{
+    int (AXIS2_CALL *process_request)(
+                axis2_iis_worker_t *iis_worker,
+                const axis2_env_t *env, 
+                void *r);
+
+    axis2_status_t (AXIS2_CALL *free)(
+                axis2_iis_worker_t *iis_worker,
+                const axis2_env_t *env);
+};
+
+
+struct axis2_iis_worker
+{
+    axis2_iis_worker_ops_t *ops;
+};
+
+
+axis2_iis_worker_t * AXIS2_CALL
+axis2_iis_worker_create(
+    const axis2_env_t *env, 
+    axis2_char_t *repo_path);
+
+
+#define AXIS2_IIS_WORKER_PROCESS_REQUEST(iis_worker, env, request)	\
+                        ((iis_worker)->ops->process_request(		\
+                        iis_worker, env, request))
+#define AXIS2_IIS_WORKER_FREE(iis_worker, env)					\
+                ((iis_worker)->ops->free(iis_worker, env))
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* AXIS2_IIS_WORKER_H */

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.c?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.c Tue Jan  9 22:24:42 2007
@@ -0,0 +1,276 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <httpfilt.h>
+#include <httpext.h>
+
+/* Axis headers */
+#include <axis2_error_default.h>
+#include <axis2_log_default.h>
+#include <axis2_thread_pool.h>
+#include <axiom_xml_reader.h>
+#include <axis2_log.h>
+
+#include "axis2_isapi_plugin.h"
+
+#include "axis2_iis_worker.h"
+#include "axis2_iis_constants.h"
+
+#define	AXIS2_IIS_LOG_FILE_TAG		("log_file")
+#define AXIS2_IIS_LOG_LEVEL_TAG		("log_level")
+#define AXIS2_IIS_REPO_PATH_TAG		("axis2c_home")
+#define AXIS2_IIS_EXTENSION_URI_TAG	("extension_uri")
+#define AXIS2_IIS_REDIRECT_WORD_TAG	("redirect_uri")
+
+#define AXIS2_IIS_LOG_TRACE_VERB	("trace")
+#define AXIS2_IIS_LOG_ERROR_VERB	("error")
+#define AXIS2_IIS_LOG_INFO_VERB		("info")
+#define AXIS2_IIS_LOG_CRITICAL_VERB	("critical")
+#define AXIS2_IIS_LOG_WARN_VERB		("warning")
+#define AXIS2_IIS_LOG_DEBUG_VERB	("debug")
+
+#define MAX_FILE_PATH				256
+
+
+#define REGISTRY_LOCATION			("Software\\Apache Axis2c\\IIS ISAPI Redirector")
+static int is_inited = FALSE;
+
+static axis2_iis_worker_t*	axis2_worker = NULL;
+static const axis2_env_t*	axis2_env = NULL;
+static axis2_char_t			repo_path[MAX_FILE_PATH] = "c:\\axis2c";
+static axis2_char_t			log_file[MAX_FILE_PATH] = "axis2.log";
+static axis2_log_levels_t	log_level = AXIS2_LOG_LEVEL_CRITICAL;
+static axis2_char_t			redirect_word[INTERNET_MAX_URL_LENGTH] = "/axis2/mod_iis.dll\?";
+
+/*
+This is a utility functipn for reading configuration data from the registery.
+*/
+static axis2_status_t read_registery_init_data();
+
+/*
+Utility function for reading 
+*/
+static axis2_status_t get_registry_config_parameter(HKEY hkey,
+                                         const char *tag, char *b, DWORD sz);
+
+/*
+Parse the given string and return the corresponding log_level
+*/
+axis2_log_levels_t axis2_iis_parse_log_level(char level[]);
+
+
+/*
+This is the entry point for the extention. The filter will redirect a 
+given request to this extentiom. 
+*/
+BOOL WINAPI GetExtensionVersion(HSE_VERSION_INFO *pVer) 
+{ 
+	  // Create the extension version string, and copy string to HSE_VERSION_INFO structure. 
+	  pVer->dwExtensionVersion =  MAKELONG(HSE_VERSION_MINOR, HSE_VERSION_MAJOR); 
+	  // Copy description string into HSE_VERSION_INFO structure. 
+	  strcpy(pVer->lpszExtensionDesc, "Apache Axis2c ISAPI Redirector"); 
+	  return TRUE; 
+} 
+
+/*
+This is the entri point for every request to the axis2c. The redirected response 
+will come here. This method invoke the axis2 engine and build the response result 
+and send it.
+*/
+DWORD WINAPI HttpExtensionProc(LPEXTENSION_CONTROL_BLOCK lpECB)
+{
+	DWORD rc = HSE_STATUS_ERROR;
+    lpECB->dwHttpStatusCode = HTTP_INTERNAL_SERVER_ERROR;
+
+	if (axis2_worker)
+		AXIS2_IIS_WORKER_PROCESS_REQUEST(axis2_worker, axis2_env, lpECB);
+	else
+		return HSE_STATUS_ERROR;
+
+	return HSE_STATUS_SUCCESS;
+}
+
+/**
+This method initializes the axis2 engine. All the required variables are set to 
+their initial values in this method.
+*/
+axis2_status_t init_axis2()
+{
+	/*
+	These are the varibles required to initialize axis.
+	*/		
+    axis2_error_t *error = NULL;
+    axis2_log_t *axis2_logger = NULL;
+    axis2_thread_pool_t *thread_pool = NULL;
+	axis2_status_t status = FALSE;	
+    // We need to init xml readers before we go into threaded env     
+	axiom_xml_reader_init();		
+	
+	status = read_registery_init_data();
+ 
+	axis2_error_init();
+
+	axis2_env = axis2_env_create_all(log_file, log_level);
+	if (axis2_env == NULL){
+		return FALSE;
+	}
+	
+	axis2_worker = axis2_iis_worker_create(axis2_env, repo_path);
+	if (axis2_worker == NULL){
+		return FALSE;
+	}	
+	return TRUE;
+}
+
+BOOL WINAPI TerminateExtension(DWORD dwFlags)
+{
+	return TRUE;
+}
+
+
+axis2_status_t axis2_terminate()
+{
+	axiom_xml_reader_cleanup();
+
+	AXIS2_IIS_WORKER_FREE(axis2_worker, axis2_env);
+
+	axis2_env_free(axis2_env);
+	return TRUE;
+}
+
+
+axis2_status_t get_extension_url(char url[], char ret_url[])
+{
+	unsigned int i = 0;	
+	// Should contain "/axis2/"
+	ret_url[0] = '\0';
+	if (!url || strlen(url) < 5){
+		return FALSE;
+	}
+	// Before searching make it to lower case
+	while (url[i] != '\0'){
+		if(url[i] >= 'A' && url[i] <= 'Z')
+			url[i] = url[i] + 'a' - 'A';
+		i++;
+	}	
+	
+	// The url should begin with "/axis2/"
+	if (url[0] == '/' && url[1] == 'a' && url[2] == 'x' && url[3] == 'i' 
+					&& url[4] == 's' && url[5] == '2' && url[6] == '/' ){		
+
+		// Append the string to redirect the request
+		strcpy(ret_url, redirect_word);
+		strcat(ret_url, &url[7]);
+		return TRUE;
+	}
+	if (url[0] == '/' && url[1] == 'a' && url[2] == 'x' && url[3] == 'i' 
+					&& url[4] == 's' && url[5] == '2' && url[6] == '\0'){
+		strcpy(ret_url, redirect_word);
+		return TRUE;
+	}	
+	return FALSE;
+}
+
+axis2_status_t read_registery_init_data()
+{
+	long rc = 0;
+	axis2_status_t ok = TRUE;
+	char tmpbuf[INTERNET_MAX_URL_LENGTH];
+	HKEY hkey;
+
+	rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+                      REGISTRY_LOCATION, (DWORD) 0, KEY_READ, &hkey);
+    
+	if (ERROR_SUCCESS != rc) {
+        return FALSE;
+    }
+
+    if (get_registry_config_parameter(hkey,
+                                      AXIS2_IIS_REPO_PATH_TAG,
+                                      tmpbuf, sizeof(repo_path))) {
+        strcpy(repo_path, tmpbuf);
+    }
+    else {
+        ok = FALSE;
+    }
+
+    if (get_registry_config_parameter(hkey,
+                                      AXIS2_IIS_LOG_FILE_TAG,
+                                      tmpbuf, sizeof(log_file))) {
+        strcpy(log_file, tmpbuf);
+    }
+    else {
+        ok = FALSE;
+    }
+
+    if (get_registry_config_parameter(hkey,
+                                      AXIS2_IIS_LOG_LEVEL_TAG,
+                                      tmpbuf, sizeof(tmpbuf))) {
+        log_level = axis2_iis_parse_log_level(tmpbuf);
+    }
+	RegCloseKey(hkey);
+
+	return ok;
+}
+
+
+
+axis2_log_levels_t axis2_iis_parse_log_level(char level[])
+{
+    if (0 == stricmp(level, AXIS2_IIS_LOG_TRACE_VERB)) {
+        return AXIS2_LOG_LEVEL_TRACE;
+    }
+
+    if (0 == stricmp(level, AXIS2_IIS_LOG_DEBUG_VERB)) {
+        return AXIS2_LOG_LEVEL_DEBUG;
+    }
+
+    if (0 == stricmp(level, AXIS2_IIS_LOG_INFO_VERB)) {
+        return AXIS2_LOG_LEVEL_INFO;
+    }
+
+    if (0 == stricmp(level, AXIS2_IIS_LOG_WARN_VERB)) {
+        return AXIS2_LOG_LEVEL_WARNING;
+    }
+
+    if (0 == stricmp(level, AXIS2_IIS_LOG_ERROR_VERB)) {
+        return AXIS2_LOG_LEVEL_ERROR;
+    }
+
+    if (0 == stricmp(level, AXIS2_IIS_LOG_CRITICAL_VERB)) {
+        return AXIS2_LOG_LEVEL_CRITICAL;
+    }
+    return AXIS2_LOG_LEVEL_CRITICAL;
+}
+
+axis2_status_t get_registry_config_parameter(HKEY hkey,
+                                         const char *tag, char *b, DWORD sz)
+{
+    DWORD type = 0;
+    LONG lrc;
+
+    lrc = RegQueryValueEx(hkey, tag, (LPDWORD) 0, &type, (LPBYTE) b, &sz);
+    if ((ERROR_SUCCESS != lrc) || (type != REG_SZ)) {
+        return FALSE;
+    }
+    b[sz] = '\0';
+    return TRUE;
+}
\ No newline at end of file

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.h?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.h (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/axis2_isapi_plugin.h Tue Jan  9 22:24:42 2007
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef	AXIS2_ISAPI_PLUGIN_H
+#define AXIS2_ISAPI_PLUGIN_H
+
+#include <axis2_utils.h>
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/*
+Initialize axis. This function is called in the begining of the module loading.
+It initializes the axis by reading values from the configuration and creating the 
+required structures for the axis2c
+*/
+axis2_status_t init_axis2();
+
+/*
+Cleanup the axis2.
+*/
+axis2_status_t axis2_terminate();
+
+/*
+Search a given uri to find weather it matches a uri for the axis2
+The uri format for axis2 is of the form
+scheme://server:port/axis2/other_parts
+This function search  a give uri for the /axis2/. If a match 
+is found it will replace the /axis2 part of the url with /axis2/mod_iis.dll?
+*/
+axis2_status_t get_extension_url(char url[], char ret_url[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c Tue Jan  9 22:24:42 2007
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <httpfilt.h>
+
+#include "..\\axis2_isapi_plugin.h"
+#include "..\\axis2_iis_constants.h"
+
+
+/*
+This function is called by the IIS server at the server 
+initialization. So this is the ideal plcae for initializing 
+axis2c.
+*/
+BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pVer) 
+{
+	DWORD rc = FALSE;
+    ULONG http_filter_revision = HTTP_FILTER_REVISION;
+    pVer->dwFilterVersion = pVer->dwServerFilterVersion;
+    if (pVer->dwFilterVersion > http_filter_revision) {
+        pVer->dwFilterVersion = http_filter_revision;
+    }
+
+	/*
+	Receive notifictions when
+		1. Server preprocessed the headers.
+		2. Log 
+		3. All the request coming in secure and none secure ports.
+	*/
+	pVer->dwFlags = (SF_NOTIFY_ORDER_HIGH |
+                    SF_NOTIFY_SECURE_PORT |
+                    SF_NOTIFY_NONSECURE_PORT |
+                    SF_NOTIFY_PREPROC_HEADERS |
+                    SF_NOTIFY_LOG |
+                    SF_NOTIFY_AUTH_COMPLETE
+					);
+
+	// Give a short discription about the module.
+	strcpy(pVer->lpszFilterDesc, "axis2c filter");
+	
+	// initialize axis2
+	rc = init_axis2();
+
+	return rc;
+}
+
+/*
+When a notification happens this function is called by the IIS.
+*/
+DWORD WINAPI HttpFilterProc(
+		PHTTP_FILTER_CONTEXT pfc,
+		DWORD notificationType,
+		LPVOID pvNotification)
+{
+		
+	DWORD bufferLength = INTERNET_MAX_URL_LENGTH;
+	char url[INTERNET_MAX_URL_LENGTH];
+	char modified_url[INTERNET_MAX_URL_LENGTH];
+
+	DWORD retVal = 0;
+	BOOL(WINAPI * GetHeader)
+		(struct _HTTP_FILTER_CONTEXT * pfc, LPSTR lpszName,
+		 LPVOID lpvBuffer, LPDWORD lpdwSize);
+	BOOL(WINAPI * SetHeader)
+		(struct _HTTP_FILTER_CONTEXT * pfc, LPSTR lpszName,
+		 LPSTR lpszValue);
+	BOOL(WINAPI * AddHeader)
+		(struct _HTTP_FILTER_CONTEXT * pfc, LPSTR lpszName,
+		 LPSTR lpszValue);
+
+	switch (notificationType)
+	{
+		case SF_NOTIFY_PREPROC_HEADERS:			
+			GetHeader = ((PHTTP_FILTER_PREPROC_HEADERS)pvNotification)->GetHeader;
+			SetHeader = ((PHTTP_FILTER_PREPROC_HEADERS)pvNotification)->SetHeader;
+
+			//GetHeader(pfc, "URL", url, &bufferLength);
+			pfc->GetServerVariable(pfc, "HTTP_URL", url, &bufferLength);			
+			retVal = get_extension_url(url, modified_url);
+			SetHeader(pfc, "URL", modified_url);
+			//return SF_STATUS_REQ_HANDLED_NOTIFICATION;
+			break;
+		case SF_NOTIFY_LOG:
+			break;
+		case SF_NOTIFY_SEND_RESPONSE:
+			break;
+		default:
+			break;
+	}
+	return SF_STATUS_REQ_NEXT_NOTIFICATION;
+}
+
+/*
+This is the exit point of the filter. Here we shut down 
+the axis2 engine.
+*/
+BOOL WINAPI TerminateFilter()
+{
+	return axis2_terminate();	
+}
+

Added: webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/mod_axis2.def
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/mod_axis2.def?view=auto&rev=494735
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/mod_axis2.def (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/IIS/mod_axis2.def Tue Jan  9 22:24:42 2007
@@ -0,0 +1,9 @@
+LIBRARY	"mod_iis"
+
+EXPORTS
+	HttpFilterProc
+	GetFilterVersion
+	GetExtensionVersion
+	HttpExtensionProc	
+	TerminateFilter
+	TerminateExtension
\ No newline at end of file



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


Mime
View raw message