From: cantor Date: Tue, 24 Mar 2009 01:24:59 +0000 (+0000) Subject: Increase parser timeout values, output complete document when saving backup copies. X-Git-Tag: 1.4.1~258 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=95ac8a0dd5d53fd659e5f58583f11f0ea2168d9d;hp=85a71038bce016c00a42bd2bdf729f9800367bb9;p=shibboleth%2Fxmltooling.git Increase parser timeout values, output complete document when saving backup copies. git-svn-id: https://svn.middleware.georgetown.edu/cpp-xmltooling/branches/REL_1@573 de75baf8-a10c-0410-a50a-987c0e22f00f --- diff --git a/xmltooling/util/CurlURLInputStream.cpp b/xmltooling/util/CurlURLInputStream.cpp index fa4f2cb..35fe364 100644 --- a/xmltooling/util/CurlURLInputStream.cpp +++ b/xmltooling/util/CurlURLInputStream.cpp @@ -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); diff --git a/xmltooling/util/ReloadableXMLFile.cpp b/xmltooling/util/ReloadableXMLFile.cpp index 0aad73b..a28ff5b 100644 --- a/xmltooling/util/ReloadableXMLFile.cpp +++ b/xmltooling/util/ReloadableXMLFile.cpp @@ -1,6 +1,6 @@ /* * 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. * You may obtain a copy of the License at @@ -16,7 +16,7 @@ /** * @file ReloadableXMLFile.cpp - * + * * Base class for file-based XML configuration. */ @@ -79,14 +79,14 @@ ReloadableXMLFile::ReloadableXMLFile(const DOMElement* e, Category& log) } else m_local=false; - + if (source && *source) { const XMLCh* flag=e->getAttributeNS(NULL,validate); m_validate=(XMLString::equals(flag,xmlconstants::XML_TRUE) || XMLString::equals(flag,xmlconstants::XML_ONE)); auto_ptr_char temp(source); m_source=temp.get(); - + if (!m_local && !strstr(m_source.c_str(),"://")) { log.warn("deprecated usage of uri/url attribute for a local resource, use path instead"); m_local=true; @@ -180,7 +180,7 @@ pair ReloadableXMLFile::load(bool backup) m_log.debug("backing up remote resource to (%s)", m_backing.c_str()); try { ofstream backer(m_backing.c_str()); - backer << *(doc->getDocumentElement()); + backer << *doc; } catch (exception& ex) { m_log.crit("exception while backing up resource: %s", ex.what()); @@ -211,7 +211,7 @@ Lockable* ReloadableXMLFile::lock() { if (!m_lock) return this; - + m_lock->rdlock(); // Check if we need to refresh. @@ -227,7 +227,7 @@ Lockable* ReloadableXMLFile::lock() #endif if (m_filestamp>=stat_buf.st_mtime) return this; - + // Elevate lock and recheck. m_log.debug("timestamp of local resource changed, elevating to a write lock"); m_lock->unlock(); @@ -267,7 +267,7 @@ Lockable* ReloadableXMLFile::lock() m_filestamp = now; m_log.info("reloading remote resource..."); } - + // Do this once... try { // At this point we're holding the write lock, so make sure we pop it. @@ -278,7 +278,7 @@ Lockable* ReloadableXMLFile::lock() } catch (exception& ex) { m_log.crit("maintaining existing configuration, error reloading resource (%s): %s", m_source.c_str(), ex.what()); } - + // If we made it here, the swap may or may not have worked, but we need to relock. m_log.debug("attempt to update resource complete, relocking"); m_lock->rdlock();