Rework support for libcurl-based input to parser.
authorScott Cantor <cantor.2@osu.edu>
Wed, 4 Feb 2009 04:15:53 +0000 (04:15 +0000)
committerScott Cantor <cantor.2@osu.edu>
Wed, 4 Feb 2009 04:15:53 +0000 (04:15 +0000)
shibsp/SPConfig.cpp
shibsp/SPConfig.h

index 7aaaf98..7d44387 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- *  Copyright 2001-2007 Internet2
+ *  Copyright 2001-2009 Internet2
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -55,7 +55,6 @@
 # include "metadata/MetadataExt.h"
 # include "security/PKIXTrustEngine.h"
 # include <saml/SAMLConfig.h>
-# include <xmltooling/util/CurlNetAccessor.hpp>
 #else
 # include <xmltooling/XMLToolingConfig.h>
 #endif
@@ -140,7 +139,6 @@ bool SPConfig::init(const char* catalog_path, const char* inst_prefix)
         log.fatal("failed to initialize OpenSAML library");
         return false;
     }
-    XMLPlatformUtils::fgNetAccessor = new CurlNetAccessor();
 #else
     if (!XMLToolingConfig::getConfig().init()) {
         log.fatal("failed to initialize XMLTooling library");
@@ -220,6 +218,9 @@ void SPConfig::term()
     log.info("%s library shutting down", PACKAGE_STRING);
 
     setServiceProvider(NULL);
+    if (m_configDoc)
+        m_configDoc->release();
+    m_configDoc = NULL;
 #ifndef SHIBSP_LITE
     setArtifactResolver(NULL);
 #endif
@@ -289,6 +290,9 @@ bool SPConfig::instantiate(const char* config, bool rethrow)
             dummydoc = XMLToolingConfig::getConfig().getParser().parse(snippet);
             XercesJanitor<xercesc::DOMDocument> docjanitor(dummydoc);
             setServiceProvider(ServiceProviderManager.newPlugin(XML_SERVICE_PROVIDER, dummydoc->getDocumentElement()));
+            if (m_configDoc)
+                m_configDoc->release();
+            m_configDoc = docjanitor.release();
         }
         else {
             stringstream snippet(config);
@@ -300,6 +304,9 @@ bool SPConfig::instantiate(const char* config, bool rethrow)
                 setServiceProvider(ServiceProviderManager.newPlugin(type.get(), dummydoc->getDocumentElement()));
             else
                 throw ConfigurationException("The supplied XML bootstrapping configuration did not include a type attribute.");
+            if (m_configDoc)
+                m_configDoc->release();
+            m_configDoc = docjanitor.release();
         }
 
         getServiceProvider()->init();
index fd8454c..99f1a22 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2007 Internet2
+ *  Copyright 2001-2009 Internet2
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -69,7 +69,8 @@ namespace shibsp {
 #ifndef SHIBSP_LITE
             m_artifactResolver(NULL),
 #endif
-            m_features(0) {}
+            m_features(0), m_configDoc(NULL) {
+        }
 
         virtual ~SPConfig() {}
 
@@ -291,6 +292,7 @@ namespace shibsp {
 
     private:
         unsigned long m_features;
+        xercesc::DOMDocument* m_configDoc;
     };
 
 #if defined (_MSC_VER)