Increase parser timeout values, output complete document when saving backup copies.
authorScott Cantor <cantor.2@osu.edu>
Tue, 24 Mar 2009 01:24:59 +0000 (01:24 +0000)
committerScott Cantor <cantor.2@osu.edu>
Tue, 24 Mar 2009 01:24:59 +0000 (01:24 +0000)
xmltooling/util/CurlURLInputStream.cpp
xmltooling/util/ReloadableXMLFile.cpp

index fa4f2cb..35fe364 100644 (file)
@@ -165,8 +165,8 @@ void CurlURLInputStream::init(const DOMElement* e)
     curl_easy_setopt(fEasy, CURLOPT_MAXREDIRS, 6);
 
     // Default settings.
-    curl_easy_setopt(fEasy, CURLOPT_CONNECTTIMEOUT,15);
-    curl_easy_setopt(fEasy, CURLOPT_TIMEOUT,30);
+    curl_easy_setopt(fEasy, CURLOPT_CONNECTTIMEOUT,30);
+    curl_easy_setopt(fEasy, CURLOPT_TIMEOUT,60);
     curl_easy_setopt(fEasy, CURLOPT_HTTPAUTH,0);
     curl_easy_setopt(fEasy, CURLOPT_USERPWD,NULL);
     curl_easy_setopt(fEasy, CURLOPT_SSL_VERIFYHOST, 2);
index 0aad73b..a28ff5b 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  *  Copyright 2001-2009 Internet2\r
- * \r
+ *\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
  * You may obtain a copy of the License at\r
@@ -16,7 +16,7 @@
 \r
 /**\r
  * @file ReloadableXMLFile.cpp\r
- * \r
+ *\r
  * Base class for file-based XML configuration.\r
  */\r
 \r
@@ -79,14 +79,14 @@ ReloadableXMLFile::ReloadableXMLFile(const DOMElement* e, Category& log)
     }\r
     else\r
         m_local=false;\r
-    \r
+\r
     if (source && *source) {\r
         const XMLCh* flag=e->getAttributeNS(NULL,validate);\r
         m_validate=(XMLString::equals(flag,xmlconstants::XML_TRUE) || XMLString::equals(flag,xmlconstants::XML_ONE));\r
 \r
         auto_ptr_char temp(source);\r
         m_source=temp.get();\r
-        \r
+\r
         if (!m_local && !strstr(m_source.c_str(),"://")) {\r
             log.warn("deprecated usage of uri/url attribute for a local resource, use path instead");\r
             m_local=true;\r
@@ -180,7 +180,7 @@ pair<bool,DOMElement*> ReloadableXMLFile::load(bool backup)
                 m_log.debug("backing up remote resource to (%s)", m_backing.c_str());\r
                 try {\r
                     ofstream backer(m_backing.c_str());\r
-                    backer << *(doc->getDocumentElement());\r
+                    backer << *doc;\r
                 }\r
                 catch (exception& ex) {\r
                     m_log.crit("exception while backing up resource: %s", ex.what());\r
@@ -211,7 +211,7 @@ Lockable* ReloadableXMLFile::lock()
 {\r
     if (!m_lock)\r
         return this;\r
-        \r
+\r
     m_lock->rdlock();\r
 \r
     // Check if we need to refresh.\r
@@ -227,7 +227,7 @@ Lockable* ReloadableXMLFile::lock()
 #endif\r
         if (m_filestamp>=stat_buf.st_mtime)\r
             return this;\r
-        \r
+\r
         // Elevate lock and recheck.\r
         m_log.debug("timestamp of local resource changed, elevating to a write lock");\r
         m_lock->unlock();\r
@@ -267,7 +267,7 @@ Lockable* ReloadableXMLFile::lock()
         m_filestamp = now;\r
         m_log.info("reloading remote resource...");\r
     }\r
-    \r
+\r
     // Do this once...\r
     try {\r
         // At this point we're holding the write lock, so make sure we pop it.\r
@@ -278,7 +278,7 @@ Lockable* ReloadableXMLFile::lock()
     } catch (exception& ex) {\r
         m_log.crit("maintaining existing configuration, error reloading resource (%s): %s", m_source.c_str(), ex.what());\r
     }\r
-    \r
+\r
     // If we made it here, the swap may or may not have worked, but we need to relock.\r
     m_log.debug("attempt to update resource complete, relocking");\r
     m_lock->rdlock();\r