Port 1.2 branch fixes
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sun, 22 Aug 2004 23:30:32 +0000 (23:30 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Sun, 22 Aug 2004 23:30:32 +0000 (23:30 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@1149 cb58f699-b61c-0410-a6fe-9272a202ed29

isapi_shib/isapi_shib.cpp
shar/shar_win32.cpp

index 2007a05..6dca650 100644 (file)
@@ -158,6 +158,11 @@ extern "C" BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pVer)
 {
     if (!pVer)
         return FALSE;
+    else if (g_Config) {
+        LogEvent(NULL, EVENTLOG_ERROR_TYPE, 2100, NULL,
+                "Reentrant filter initialization, ignoring...");
+        return TRUE;
+    }
 
     try
     {
@@ -207,6 +212,9 @@ extern "C" BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pVer)
     catch (...)
     {
         LogEvent(NULL, EVENTLOG_ERROR_TYPE, 2100, NULL, "Filter startup failed with an exception.");
+#ifdef _DEBUG
+        throw;
+#endif
         return FALSE;
     }
 
@@ -362,23 +370,25 @@ IRequestMapper::Settings map_request(
     const char* scheme=site.m_scheme.c_str();
     if (!scheme || !*scheme || !g_bNormalizeRequest)
         scheme=pfc->fIsSecurePort ? "https" : "http";
-    
-    // Start with path.
-    if (!url.empty())
-        target=static_cast<char*>(url);
-    
-    // If port is non-default, prepend it.
-    if ((!strcmp(scheme,"http") && port!="80") || (!strcmp(scheme,"https") && port!="443"))
-        target = ':' + static_cast<char*>(port) + target;
 
+    // Start with scheme and hostname.
     if (g_bNormalizeRequest) {
-        target = string(scheme) + "://" + site.m_name + target;
+        target = string(scheme) + "://" + site.m_name;
     }
     else {
         dynabuf name(64);
         GetServerVariable(pfc,"SERVER_NAME",name,64);
-        target = string(scheme) + "://" + static_cast<char*>(name) + target;
+        target = string(scheme) + "://" + static_cast<char*>(name);
     }
+    
+    // If port is non-default, append it.
+    if ((!strcmp(scheme,"http") && port!="80") || (!strcmp(scheme,"https") && port!="443"))
+        target = target + ':' + static_cast<char*>(port);
+
+    // Append path.
+    if (!url.empty())
+        target+=static_cast<char*>(url);
+    
     return mapper->getSettingsFromParsedURL(scheme,site.m_name.c_str(),strtoul(port,NULL,10),url);
 }
 
@@ -774,23 +784,25 @@ IRequestMapper::Settings map_request(
     const char* scheme=site.m_scheme.c_str();
     if (!scheme || !*scheme || !g_bNormalizeRequest)
         scheme=lpECB->lpszMethod;
-    
-    // Start with path.
-    if (!url.empty())
-        target=static_cast<char*>(url);
-    
-    // If port is non-default, prepend it.
-    if ((!strcmp(scheme,"http") && port!="80") || (!strcmp(scheme,"https") && port!="443"))
-        target = ':' + static_cast<char*>(port) + target;
 
+    // Start with scheme and hostname.
     if (g_bNormalizeRequest) {
-        target = string(scheme) + "://" + site.m_name + target;
+        target = string(scheme) + "://" + site.m_name;
     }
     else {
         dynabuf name(64);
         GetServerVariable(lpECB,"SERVER_NAME",name,64);
-        target = string(scheme) + "://" + static_cast<char*>(name) + target;
+        target = string(scheme) + "://" + static_cast<char*>(name);
     }
+    
+    // If port is non-default, append it.
+    if ((!strcmp(scheme,"http") && port!="80") || (!strcmp(scheme,"https") && port!="443"))
+        target = target + ':' + static_cast<char*>(port);
+
+    // Append path.
+    if (!url.empty())
+        target+=static_cast<char*>(url);
+    
     return mapper->getSettingsFromParsedURL(scheme,site.m_name.c_str(),strtoul(port,NULL,10),url);
 }
 
index 9c7dc64..1fb36b8 100644 (file)
@@ -418,7 +418,7 @@ void CmdInstallService(LPCSTR name)
 
         if ( schService )
         {
-            printf("%s installed.\n",name);
+            printf("%s installed.\n",realName);
             CloseServiceHandle(schService);
         }
         else
@@ -447,7 +447,7 @@ void CmdRemoveService(LPCSTR name)
                         );
     if ( schSCManager )
     {
-        schService = OpenService(schSCManager, name, SERVICE_ALL_ACCESS);
+        schService = OpenService(schSCManager, realName, SERVICE_ALL_ACCESS);
 
         if (schService)
         {
@@ -469,15 +469,15 @@ void CmdRemoveService(LPCSTR name)
                 }
 
                 if ( ssStatus.dwCurrentState == SERVICE_STOPPED )
-                    printf("\n%s stopped.\n", name);
+                    printf("\n%s stopped.\n", realName);
                 else
-                    printf("\n%s failed to stop.\n", name);
+                    printf("\n%s failed to stop.\n", realName);
 
             }
 
             // now remove the service
             if( DeleteService(schService) )
-                printf("%s removed.\n", name);
+                printf("%s removed.\n", realName);
             else
                 printf("DeleteService failed - %s\n", GetLastErrorText(szErr,256));