#include "internal.h"
#include "logging.h"
+#include "io/HTTPResponse.h"
#include "security/BasicX509Credential.h"
#include "security/CredentialCriteria.h"
#include "security/CredentialResolver.h"
SOAPTransport* getTransport() {
SOAPTransport::Address addr("FilesystemCredentialResolver", source.c_str(), source.c_str());
string scheme(addr.m_endpoint, strchr(addr.m_endpoint,':') - addr.m_endpoint);
- return XMLToolingConfig::getConfig().SOAPTransportManager.newPlugin(scheme.c_str(), addr);
+ SOAPTransport* ret = XMLToolingConfig::getConfig().SOAPTransportManager.newPlugin(scheme.c_str(), addr);
+ if (ret)
+ ret->setCacheTag(&cacheTag);
+ return ret;
}
public:
}
bool local,reloadChanges;
- string format,source,backing;
+ string format,source,backing,cacheTag;
time_t filestamp,reloadInterval;
};
m_key.load(log, m_keypass.c_str());
updated = true;
}
+ catch (long& ex) {
+ if (ex == HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED) {
+ log.info("remote key (%s) unchanged from cached version", m_key.source.c_str());
+ }
+ else {
+ // Shouldn't happen, we should only get codes intended to be gracefully handled.
+ log.crit("maintaining existing key, remote fetch returned atypical status code (%d)", ex);
+ }
+ }
catch (exception& ex) {
log.crit("maintaining existing key: %s", ex.what());
}
i->load(log, (i==m_certs.begin()) ? m_certpass.c_str() : NULL);
updated = true;
}
+ catch (long& ex) {
+ if (ex == HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED) {
+ log.info("remote certificate(s) (%s) unchanged from cached version", i->source.c_str());
+ }
+ else {
+ // Shouldn't happen, we should only get codes intended to be gracefully handled.
+ log.crit("maintaining existing certificate(s), remote fetch returned atypical status code (%d)", ex);
+ }
+ }
catch (exception& ex) {
log.crit("maintaining existing certificate(s): %s", ex.what());
}
j->load(log);
updated = true;
}
+ catch (long& ex) {
+ if (ex == HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED) {
+ log.info("remote CRL(s) (%s) unchanged from cached version", j->source.c_str());
+ }
+ else {
+ // Shouldn't happen, we should only get codes intended to be gracefully handled.
+ log.crit("maintaining existing CRL(s), remote fetch returned atypical status code (%d)", ex);
+ }
+ }
catch (exception& ex) {
log.crit("maintaining existing CRL(s): %s", ex.what());
}
#include "internal.h"
#include "logging.h"
+#include "io/HTTPResponse.h"
#include "security/OpenSSLCryptoX509CRL.h"
#include "security/SecurityHelper.h"
#include "security/X509Credential.h"
+#include "soap/HTTPSOAPTransport.h"
#include "util/NDC.h"
#include <fstream>
transport.send();
istream& msg = transport.receive();
+ // Check for "not modified" status.
+ if (dynamic_cast<HTTPSOAPTransport*>(&transport) && transport.getStatusCode() == HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED)
+ throw (long)HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED;
+
// Dump to output file.
ofstream out(backing, fstream::trunc|fstream::binary);
out << msg.rdbuf();
transport.send();
istream& msg = transport.receive();
+ // Check for "not modified" status.
+ if (dynamic_cast<HTTPSOAPTransport*>(&transport) && transport.getStatusCode() == HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED)
+ throw (long)HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED;
+
// Dump to output file.
ofstream out(backing, fstream::trunc|fstream::binary);
out << msg.rdbuf();
transport.send();
istream& msg = transport.receive();
+ // Check for "not modified" status.
+ if (dynamic_cast<HTTPSOAPTransport*>(&transport) && transport.getStatusCode() == HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED)
+ throw (long)HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED;
+
// Dump to output file.
ofstream out(backing, fstream::trunc|fstream::binary);
out << msg.rdbuf();