Modified: 
axis/axis2/c/core/trunk/src/core/transport/http/server/IIS/axis2_isapi_plugin.c
URL: 
http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/src/core/transport/http/server/IIS/axis2_isapi_plugin.c?rev=958884&r1=958883&r2=958884&view=diff
==============================================================================
--- 
axis/axis2/c/core/trunk/src/core/transport/http/server/IIS/axis2_isapi_plugin.c 
(original)
+++ 
axis/axis2/c/core/trunk/src/core/transport/http/server/IIS/axis2_isapi_plugin.c 
Tue Jun 29 08:57:05 2010
@@ -1,42 +1,42 @@
-
-/*
- * 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>
-
-#include "axis2_iis_constants.h"
-#include "axis2_iis_worker.h"
-
+
+/*
+ * 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>
+
+#include "axis2_iis_constants.h"
+#include "axis2_iis_worker.h"
+
 /* Axis headers */ 
 #include <axutil_error_default.h>
 #include <axutil_log_default.h>
 #include <axutil_thread_pool.h>
 #include <axiom_xml_reader.h>
-#include <axutil_log.h>
-
-#ifndef _WIN32_WINNT 
-#define _WIN32_WINNT 0x0500 
-#endif 
-
+#include <axutil_log.h>
+
+#ifndef _WIN32_WINNT 
+#define _WIN32_WINNT 0x0500 
+#endif 
+
 #define        AXIS2_IIS_LOG_FILE_TAG           "log_file"
 #define AXIS2_IIS_LOG_LEVEL_TAG                 "log_level" 
 #define AXIS2_IIS_REPO_PATH_TAG                 "axis2c_home"
@@ -68,19 +68,19 @@ static axis2_char_t log_file[MAX_FILE_PA
 static axutil_log_levels_t log_level            = AXIS2_LOG_LEVEL_CRITICAL;
 
 /* Path variables */ 
-static char szOriginalPath[_MAX_PATH + 1];
+static char szOriginalPath[_MAX_PATH + 1];
 static char szPath[_MAX_PATH + 1];
 
-axis2_char_t    general_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" 
+axis2_char_t    general_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 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" 
+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.</hr></html>"; 
 
 
@@ -103,243 +103,243 @@ static axis2_status_t AXIS2_CALL get_reg
  * Parse the given string and return the corresponding log_level
  */ 
 axutil_log_levels_t AXIS2_CALL axis2_iis_parse_log_level(char level[]);
-
-/*
- * 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 AXIS2_CALL init_axis2();
-    
-/* 
- * This is the function to be called after the processing 
- * is over for non Axis2 requets
- */
-VOID 
-WINAPI 
-ExecUrlCompletion ( 
-    EXTENSION_CONTROL_BLOCK *   pecb, 
-    PVOID                       pContext, 
-    DWORD                       cbIO, 
-    DWORD                       dwError 
-    ); 
-
-/* 
- * If somethign went wrong in the IIS server when 
- * we are proccessing we send this 
- */
-BOOL 
-send_error(            
-       EXTENSION_CONTROL_BLOCK * pecb, 
-    CHAR error[]); 
-
-axis2_status_t AXIS2_CALL init_axis2();
-
-BOOL 
-WINAPI 
-GetExtensionVersion(HSE_VERSION_INFO * pVer)  
-{     
-    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR, 
-                                         HSE_VERSION_MAJOR); 
-    strncpy( pVer->lpszExtensionDesc, 
-             "WildCardMap Sample ISAPI Extension", HSE_MAX_EXT_DLL_NAME_LEN ); 
-
-    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0'; 
-       server_version = 5;
-       return TRUE; 
-} 
-
-DWORD 
-WINAPI 
-HttpExtensionProc(EXTENSION_CONTROL_BLOCK * pecb) 
-
-{ 
-    HSE_EXEC_URL_INFO   ExecUrlInfo; 
-    DWORD               cbData = INTERNET_MAX_URL_LENGTH; 
-    char                               url[INTERNET_MAX_URL_LENGTH]; 
-       axis2_bool_t            is_for_us = AXIS2_TRUE;
-
-    /* Get the URL */      
-    if ( pecb->GetServerVariable( pecb->ConnID, 
-                                  "URL", 
-                                  url, 
-                                  &cbData ) == FALSE ) 
-    { 
-        return HSE_STATUS_ERROR;  
-    } 
-
-       if (!is_inited) 
-       {                       
-               DWORD dwBufferSize = 0;
-               axis2_char_t server_software[256];
-               axis2_char_t *version = NULL;
-
-               ZeroMemory(szOriginalPath, sizeof szOriginalPath);
-               dwBufferSize = sizeof szOriginalPath;
-
-#if _WIN32_WINNT >= 0x0502
-               GetDllDirectory( dwBufferSize, szOriginalPath );
-#else
-               GetCurrentDirectory( dwBufferSize, szOriginalPath );
-#endif
-               ZeroMemory(szPath, sizeof szPath);
-               dwBufferSize = sizeof szPath;
-               /* Get the current physical paht */
-               if (pecb->GetServerVariable(pecb->ConnID, "APPL_PHYSICAL_PATH", 
szPath, &dwBufferSize) == FALSE)
-               {
-                       send_error(pecb, initializing_error);
-                       return HSE_STATUS_ERROR;                                
-               }
-               /* Retrieve the server version */
-               dwBufferSize = 32;
-               if (pecb->GetServerVariable(pecb->ConnID, "SERVER_SOFTWARE", 
server_software, &dwBufferSize) == FALSE)
-               {
-                       send_error(pecb, initializing_error);
-                       return HSE_STATUS_ERROR;                                
-               }
-               version = axutil_strchr(server_software, '/');  
-               if (version)
-               {
-                       server_version = atoi(version + 1);
-               }
-#if _WIN32_WINNT >= 0x0502
-               SetDllDirectory( szPath );
-#else
-               SetCurrentDirectory( szPath );
-#endif
-               /* If we haven't initialized axis2/c before initialization 
failed */
-               if (AXIS2_FAILURE == init_axis2())
-               {
-                       send_error(pecb, initializing_error);
-                       return HSE_STATUS_ERROR;
-               }
-#if _WIN32_WINNT >= 0x0502
-               SetDllDirectory( szOriginalPath );
-#else
-               SetCurrentDirectory( szOriginalPath );
-#endif
-       }
-
-       /* Check weather we have a request for Axis2/C */
-       if (server_version >= 6 && strlen(url) >= strlen(axis2_location))
-    {
-               int i = 0;
-               is_for_us = AXIS2_TRUE; 
-               while (axis2_location[i] != '\0')
-               {
-                       if (axis2_location[i] != (url)[i]) {
-                               is_for_us = AXIS2_FALSE;
-                               break;
-                       }
-                       i++;
-               }               
-               if (url[i] != '/' && url[i] != '\0')
-               {
-                       is_for_us = AXIS2_FALSE;
-               }
-       }
-               
-       if (is_for_us)
-       {                       
-               /* Windows cannot find the correct dlls unless the path is 
set*/ 
-#if _WIN32_WINNT >= 0x0502
-               SetDllDirectory( szPath );
-#else
-               SetCurrentDirectory( szPath );
-#endif
-               pecb->dwHttpStatusCode = HTTP_INTERNAL_SERVER_ERROR;
-               /* We are sure that worker is not NULL since it is NULL 
init_axis2 would have failed */
-               axis2_iis_worker_process_request(axis2_worker, axutil_env, 
pecb);
-
-           /* Windows cannot find the correct dlls unless the dir is set
-                but we want to reset to previous dir after the load */
-#if _WIN32_WINNT >= 0x0502
-               SetDllDirectory( szOriginalPath );
-#else
-               SetCurrentDirectory( szOriginalPath );
-#endif
-               return HSE_STATUS_SUCCESS;
-       }
-       else if (server_version >= 6)
-       {
-               /* For IIS 5.1 or earlier this code is never executed. Since 
the URL is 
-               redirected to Axis2/C by the Filter */
-
-               /* If not for Axis2/C let the request go to who ever wants it */
-               ExecUrlInfo.pszUrl = NULL;          /* Use original request URL 
*/
-               ExecUrlInfo.pszMethod = NULL;       /* Use original request 
method */
-               ExecUrlInfo.pszChildHeaders = NULL; /* Use original request 
headers */
-               ExecUrlInfo.pUserInfo = NULL;       /* Use original request 
user info */
-               ExecUrlInfo.pEntity = NULL;         /* Use original request 
entity */
-               
-               /* Provent recursion */
-               ExecUrlInfo.dwExecUrlFlags = 
HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR; 
-            
-               /* Associate the completion routine and the current URL with 
this request. */ 
-               if ( pecb->ServerSupportFunction( pecb->ConnID, 
-                                                                               
  HSE_REQ_IO_COMPLETION, 
-                                                                               
  ExecUrlCompletion, 
-                                                                               
  NULL,  
-                                                                               
  NULL) == FALSE ) 
-               {        
-                       return HSE_STATUS_ERROR; 
-               } 
-                       
-               /* Ok, now that everything is set up, let's call the child 
request */     
-               if ( pecb->ServerSupportFunction( pecb->ConnID, 
-                                                                               
  HSE_REQ_EXEC_URL, 
-                                                                               
  &ExecUrlInfo, 
-                                                                               
  NULL, 
-                                                                               
  NULL ) == FALSE ) 
-               {         
-                       return HSE_STATUS_ERROR; 
-               } 
-               /* Return pending and let the completion clean up */ 
-               return HSE_STATUS_PENDING; 
-       } 
-       return HSE_STATUS_ERROR;
-} 
-
-VOID 
-WINAPI 
-ExecUrlCompletion ( 
-    EXTENSION_CONTROL_BLOCK *   pecb, 
-    PVOID                       pContext, 
-    DWORD                       cbIO, 
-    DWORD                       dwError 
-    ) 
-{ 
-       /* We are done so notify */
-    pecb->ServerSupportFunction( 
-        pecb->ConnID, 
-        HSE_REQ_DONE_WITH_SESSION, 
-        NULL, 
-        NULL, 
-        NULL); 
-} 
-
-
-BOOL 
-send_error(            
-       EXTENSION_CONTROL_BLOCK * pecb, 
-    axis2_char_t error[]) 
-{ 
-    DWORD   cbData;             
-    pecb->dwHttpStatusCode = 500;     
-    /* Send headers and response */    
-    pecb->ServerSupportFunction( pecb->ConnID, 
-                                 HSE_REQ_SEND_RESPONSE_HEADER, 
-                                 "500 Server Error", 
-                                 NULL, 
-                                 (LPDWORD)"Content-Type: text/html\r\n\r\n" ); 
-
-    cbData = axutil_strlen( error ); 
-    return pecb->WriteClient( pecb->ConnID, 
-                              error, 
-                              &cbData, 
-                              HSE_IO_SYNC ); 
-} 
-
+
+/*
+ * 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 AXIS2_CALL init_axis2();
+    
+/* 
+ * This is the function to be called after the processing 
+ * is over for non Axis2 requets
+ */
+VOID 
+WINAPI 
+ExecUrlCompletion ( 
+    EXTENSION_CONTROL_BLOCK *   pecb, 
+    PVOID                       pContext, 
+    DWORD                       cbIO, 
+    DWORD                       dwError 
+    ); 
+
+/* 
+ * If somethign went wrong in the IIS server when 
+ * we are proccessing we send this 
+ */
+BOOL 
+send_error(            
+       EXTENSION_CONTROL_BLOCK * pecb, 
+    CHAR error[]); 
+
+axis2_status_t AXIS2_CALL init_axis2();
+
+BOOL 
+WINAPI 
+GetExtensionVersion(HSE_VERSION_INFO * pVer)  
+{     
+    pVer->dwExtensionVersion = MAKELONG( HSE_VERSION_MINOR, 
+                                         HSE_VERSION_MAJOR); 
+    strncpy( pVer->lpszExtensionDesc, 
+             "WildCardMap Sample ISAPI Extension", HSE_MAX_EXT_DLL_NAME_LEN ); 
+
+    pVer->lpszExtensionDesc[HSE_MAX_EXT_DLL_NAME_LEN-1] = '\0'; 
+       server_version = 5;
+       return TRUE; 
+} 
+
+DWORD 
+WINAPI 
+HttpExtensionProc(EXTENSION_CONTROL_BLOCK * pecb) 
+
+{ 
+    HSE_EXEC_URL_INFO   ExecUrlInfo; 
+    DWORD               cbData = INTERNET_MAX_URL_LENGTH; 
+    char                               url[INTERNET_MAX_URL_LENGTH]; 
+       axis2_bool_t            is_for_us = AXIS2_TRUE;
+
+    /* Get the URL */      
+    if ( pecb->GetServerVariable( pecb->ConnID, 
+                                  "URL", 
+                                  url, 
+                                  &cbData ) == FALSE ) 
+    { 
+        return HSE_STATUS_ERROR;  
+    } 
+
+       if (!is_inited) 
+       {                       
+               DWORD dwBufferSize = 0;
+               axis2_char_t server_software[256];
+               axis2_char_t *version = NULL;
+
+               ZeroMemory(szOriginalPath, sizeof szOriginalPath);
+               dwBufferSize = sizeof szOriginalPath;
+
+#if _WIN32_WINNT >= 0x0502
+               GetDllDirectory( dwBufferSize, szOriginalPath );
+#else
+               GetCurrentDirectory( dwBufferSize, szOriginalPath );
+#endif
+               ZeroMemory(szPath, sizeof szPath);
+               dwBufferSize = sizeof szPath;
+               /* Get the current physical paht */
+               if (pecb->GetServerVariable(pecb->ConnID, "APPL_PHYSICAL_PATH", 
szPath, &dwBufferSize) == FALSE)
+               {
+                       send_error(pecb, initializing_error);
+                       return HSE_STATUS_ERROR;                                
+               }
+               /* Retrieve the server version */
+               dwBufferSize = 32;
+               if (pecb->GetServerVariable(pecb->ConnID, "SERVER_SOFTWARE", 
server_software, &dwBufferSize) == FALSE)
+               {
+                       send_error(pecb, initializing_error);
+                       return HSE_STATUS_ERROR;                                
+               }
+               version = axutil_strchr(server_software, '/');  
+               if (version)
+               {
+                       server_version = atoi(version + 1);
+               }
+#if _WIN32_WINNT >= 0x0502
+               SetDllDirectory( szPath );
+#else
+               SetCurrentDirectory( szPath );
+#endif
+               /* If we haven't initialized axis2/c before initialization 
failed */
+               if (AXIS2_FAILURE == init_axis2())
+               {
+                       send_error(pecb, initializing_error);
+                       return HSE_STATUS_ERROR;
+               }
+#if _WIN32_WINNT >= 0x0502
+               SetDllDirectory( szOriginalPath );
+#else
+               SetCurrentDirectory( szOriginalPath );
+#endif
+       }
+
+       /* Check weather we have a request for Axis2/C */
+       if (server_version >= 6 && strlen(url) >= strlen(axis2_location))
+    {
+               int i = 0;
+               is_for_us = AXIS2_TRUE; 
+               while (axis2_location[i] != '\0')
+               {
+                       if (axis2_location[i] != (url)[i]) {
+                               is_for_us = AXIS2_FALSE;
+                               break;
+                       }
+                       i++;
+               }               
+               if (url[i] != '/' && url[i] != '\0')
+               {
+                       is_for_us = AXIS2_FALSE;
+               }
+       }
+               
+       if (is_for_us)
+       {                       
+               /* Windows cannot find the correct dlls unless the path is 
set*/ 
+#if _WIN32_WINNT >= 0x0502
+               SetDllDirectory( szPath );
+#else
+               SetCurrentDirectory( szPath );
+#endif
+               pecb->dwHttpStatusCode = HTTP_INTERNAL_SERVER_ERROR;
+               /* We are sure that worker is not NULL since it is NULL 
init_axis2 would have failed */
+               axis2_iis_worker_process_request(axis2_worker, axutil_env, 
pecb);
+
+           /* Windows cannot find the correct dlls unless the dir is set
+                but we want to reset to previous dir after the load */
+#if _WIN32_WINNT >= 0x0502
+               SetDllDirectory( szOriginalPath );
+#else
+               SetCurrentDirectory( szOriginalPath );
+#endif
+               return HSE_STATUS_SUCCESS;
+       }
+       else if (server_version >= 6)
+       {
+               /* For IIS 5.1 or earlier this code is never executed. Since 
the URL is 
+               redirected to Axis2/C by the Filter */
+
+               /* If not for Axis2/C let the request go to who ever wants it */
+               ExecUrlInfo.pszUrl = NULL;          /* Use original request URL 
*/
+               ExecUrlInfo.pszMethod = NULL;       /* Use original request 
method */
+               ExecUrlInfo.pszChildHeaders = NULL; /* Use original request 
headers */
+               ExecUrlInfo.pUserInfo = NULL;       /* Use original request 
user info */
+               ExecUrlInfo.pEntity = NULL;         /* Use original request 
entity */
+               
+               /* Provent recursion */
+               ExecUrlInfo.dwExecUrlFlags = 
HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR; 
+            
+               /* Associate the completion routine and the current URL with 
this request. */ 
+               if ( pecb->ServerSupportFunction( pecb->ConnID, 
+                                                                               
  HSE_REQ_IO_COMPLETION, 
+                                                                               
  ExecUrlCompletion, 
+                                                                               
  NULL,  
+                                                                               
  NULL) == FALSE ) 
+               {        
+                       return HSE_STATUS_ERROR; 
+               } 
+                       
+               /* Ok, now that everything is set up, let's call the child 
request */     
+               if ( pecb->ServerSupportFunction( pecb->ConnID, 
+                                                                               
  HSE_REQ_EXEC_URL, 
+                                                                               
  &ExecUrlInfo, 
+                                                                               
  NULL, 
+                                                                               
  NULL ) == FALSE ) 
+               {         
+                       return HSE_STATUS_ERROR; 
+               } 
+               /* Return pending and let the completion clean up */ 
+               return HSE_STATUS_PENDING; 
+       } 
+       return HSE_STATUS_ERROR;
+} 
+
+VOID 
+WINAPI 
+ExecUrlCompletion ( 
+    EXTENSION_CONTROL_BLOCK *   pecb, 
+    PVOID                       pContext, 
+    DWORD                       cbIO, 
+    DWORD                       dwError 
+    ) 
+{ 
+       /* We are done so notify */
+    pecb->ServerSupportFunction( 
+        pecb->ConnID, 
+        HSE_REQ_DONE_WITH_SESSION, 
+        NULL, 
+        NULL, 
+        NULL); 
+} 
+
+
+BOOL 
+send_error(            
+       EXTENSION_CONTROL_BLOCK * pecb, 
+    axis2_char_t error[]) 
+{ 
+    DWORD   cbData;             
+    pecb->dwHttpStatusCode = 500;     
+    /* Send headers and response */    
+    pecb->ServerSupportFunction( pecb->ConnID, 
+                                 HSE_REQ_SEND_RESPONSE_HEADER, 
+                                 "500 Server Error", 
+                                 NULL, 
+                                 (LPDWORD)"Content-Type: text/html\r\n\r\n" ); 
+
+    cbData = axutil_strlen( error ); 
+    return pecb->WriteClient( pecb->ConnID, 
+                              error, 
+                              &cbData, 
+                              HSE_IO_SYNC ); 
+} 
+
 axis2_status_t AXIS2_CALL read_registery_init_data() 
 {
     long rc = 0;

Modified: 
axis/axis2/c/core/trunk/src/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c
URL: 
http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/src/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c?rev=958884&r1=958883&r2=958884&view=diff
==============================================================================
--- 
axis/axis2/c/core/trunk/src/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c
 (original)
+++ 
axis/axis2/c/core/trunk/src/core/transport/http/server/IIS/iis_iaspi_plugin_51/axis2_isapi_51.c
 Tue Jun 29 08:57:05 2010
@@ -1,153 +1,153 @@
-/*
- * 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_const.h>
-#include <axis2_defines.h>
-#include <axutil_env.h>
-#include <axutil_stream.h>
-
-#include "..\\axis2_iis_constants.h"
-
-#define REGISTRY_LOC                    "Software\\Apache Axis2c\\IIS ISAPI 
Redirector"
-#define AXIS2_IIS_AXIS2_LOC             "axis2_location" 
-static char *axis2_loc = "/axis2";
-
-static axis2_char_t redirect_word[INTERNET_MAX_URL_LENGTH] = 
"/axis2/mod_axis2_IIS.dll\?";
-/*
- * 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_bool_t AXIS2_CALL
-get_extension_url(
-    char url[],
-    char ret_url[]);
-
-/*
- * 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 type = 0, size = 0;
-    LONG lrc = 0;
-    char tmpbuf[INTERNET_MAX_URL_LENGTH];
-    HKEY hkey;
-    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_PREPROC_HEADERS | 
SF_NOTIFY_SECURE_PORT
-        | SF_NOTIFY_NONSECURE_PORT | SF_NOTIFY_AUTH_COMPLETE);
-
-    /* Give a short discription about the module.*/
-    strcpy(pVer->lpszFilterDesc, "axis2c filter");
-    /* Get the axis2 location from the registry configuration */
-    lrc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_LOC, (DWORD)0, KEY_READ, 
&hkey);
-    if(ERROR_SUCCESS != lrc)
-    {
-        return FALSE;
-    }
-    size = INTERNET_MAX_URL_LENGTH;
-    lrc = RegQueryValueEx(hkey, AXIS2_IIS_AXIS2_LOC, (LPDWORD)0, &type, 
(LPBYTE)tmpbuf, &size);
-    if((ERROR_SUCCESS == lrc) && (type == REG_SZ))
-    {
-        tmpbuf[size] = '\0';
-        axis2_loc = _strdup(tmpbuf);
-    }
-    RegCloseKey(hkey);
-    return TRUE;
-}
-
-/*
- 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];
-
-    if(notificationType == SF_NOTIFY_PREPROC_HEADERS)
-    {
-        pfc->GetServerVariable(pfc, "HTTP_URL", url, &bufferLength);
-        if(get_extension_url(url, modified_url))
-        {
-            ((PHTTP_FILTER_PREPROC_HEADERS)pvNotification)->SetHeader(pfc, 
"url", modified_url);
-            return SF_STATUS_REQ_HANDLED_NOTIFICATION;
-        }
-    }
-    return SF_STATUS_REQ_NEXT_NOTIFICATION;
-}
-
-axis2_bool_t AXIS2_CALL
-get_extension_url(
-    char url[],
-    char ret_url[])
-{
-    axis2_bool_t is_for_us = AXIS2_FALSE;
-    int i = 0;
-    /* Should contain "/axis2/"*/
-    ret_url[0] = '\0';
-    if(strlen(url) >= strlen(axis2_loc))
-    {
-        is_for_us = AXIS2_TRUE;
-        while(axis2_loc[i] != '\0')
-        {
-            if(axis2_loc[i] != (url)[i])
-            {
-                is_for_us = AXIS2_FALSE;
-                break;
-            }
-            i++;
-        }
-        if(url[i] != '/' && url[i] != '\0')
-        {
-            is_for_us = AXIS2_FALSE;
-        }
-    }
-    if(is_for_us)
-    {
-        strcpy(ret_url, redirect_word);
-        strcat(ret_url, &url[i]);
-    }
-    return is_for_us;
-}
+/*
+ * 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_const.h>
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <axutil_stream.h>
+
+#include "..\\axis2_iis_constants.h"
+
+#define REGISTRY_LOC                    "Software\\Apache Axis2c\\IIS ISAPI 
Redirector"
+#define AXIS2_IIS_AXIS2_LOC             "axis2_location" 
+static char *axis2_loc = "/axis2";
+
+static axis2_char_t redirect_word[INTERNET_MAX_URL_LENGTH] = 
"/axis2/mod_axis2_IIS.dll\?";
+/*
+ * 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_bool_t AXIS2_CALL
+get_extension_url(
+    char url[],
+    char ret_url[]);
+
+/*
+ * 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 type = 0, size = 0;
+    LONG lrc = 0;
+    char tmpbuf[INTERNET_MAX_URL_LENGTH];
+    HKEY hkey;
+    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_PREPROC_HEADERS | 
SF_NOTIFY_SECURE_PORT
+        | SF_NOTIFY_NONSECURE_PORT | SF_NOTIFY_AUTH_COMPLETE);
+
+    /* Give a short discription about the module.*/
+    strcpy(pVer->lpszFilterDesc, "axis2c filter");
+    /* Get the axis2 location from the registry configuration */
+    lrc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGISTRY_LOC, (DWORD)0, KEY_READ, 
&hkey);
+    if(ERROR_SUCCESS != lrc)
+    {
+        return FALSE;
+    }
+    size = INTERNET_MAX_URL_LENGTH;
+    lrc = RegQueryValueEx(hkey, AXIS2_IIS_AXIS2_LOC, (LPDWORD)0, &type, 
(LPBYTE)tmpbuf, &size);
+    if((ERROR_SUCCESS == lrc) && (type == REG_SZ))
+    {
+        tmpbuf[size] = '\0';
+        axis2_loc = _strdup(tmpbuf);
+    }
+    RegCloseKey(hkey);
+    return TRUE;
+}
+
+/*
+ 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];
+
+    if(notificationType == SF_NOTIFY_PREPROC_HEADERS)
+    {
+        pfc->GetServerVariable(pfc, "HTTP_URL", url, &bufferLength);
+        if(get_extension_url(url, modified_url))
+        {
+            ((PHTTP_FILTER_PREPROC_HEADERS)pvNotification)->SetHeader(pfc, 
"url", modified_url);
+            return SF_STATUS_REQ_HANDLED_NOTIFICATION;
+        }
+    }
+    return SF_STATUS_REQ_NEXT_NOTIFICATION;
+}
+
+axis2_bool_t AXIS2_CALL
+get_extension_url(
+    char url[],
+    char ret_url[])
+{
+    axis2_bool_t is_for_us = AXIS2_FALSE;
+    int i = 0;
+    /* Should contain "/axis2/"*/
+    ret_url[0] = '\0';
+    if(strlen(url) >= strlen(axis2_loc))
+    {
+        is_for_us = AXIS2_TRUE;
+        while(axis2_loc[i] != '\0')
+        {
+            if(axis2_loc[i] != (url)[i])
+            {
+                is_for_us = AXIS2_FALSE;
+                break;
+            }
+            i++;
+        }
+        if(url[i] != '/' && url[i] != '\0')
+        {
+            is_for_us = AXIS2_FALSE;
+        }
+    }
+    if(is_for_us)
+    {
+        strcpy(ret_url, redirect_word);
+        strcat(ret_url, &url[i]);
+    }
+    return is_for_us;
+}


Reply via email to