Add Amazon protocol version as a parameter

as to smooth the transition from SHA-1 to SHA-256 signing
This commit is contained in:
Jean-Marie Verdun
2020-05-30 10:09:25 -04:00
committed by Yorik van Havre
parent 96d81c77b2
commit 1883bf560f
2 changed files with 18 additions and 0 deletions

View File

@@ -125,6 +125,17 @@ Py::Object Cloud::Module::sCloudRestore(const Py::Tuple& args)
return Py::None();
}
Py::Object Cloud::Module::sCloudProtocolVersion(const Py::Tuple& args)
{
char *ProtocolVersion;
if (!PyArg_ParseTuple(args.ptr(), "et","utf-8", &TCPPort)) // convert args: Python->C
return Py::None();
if (this->ProtocolVersion.getStrValue() != ProtocolVersion) {
this->ProtocolVersion.setValue(ProtocolVersion);
}
return Py::None();
}
struct data_buffer
{
const char *ptr;

View File

@@ -122,6 +122,10 @@ public:
"Restore(string) -- Restore to the active document from the Cloud."
);
add_varargs_method("ProtocolVersion",&Module::sCloudProtocolVersion,
"ProtocolVersion(string) -- Specify Amazon s3 protocol version (2 or 4)"
);
initialize("This module is the Cloud module."); // register with Python
}
@@ -131,6 +135,7 @@ public:
App::PropertyString TCPPort;
App::PropertyString TokenAuth;
App::PropertyString TokenSecret;
App::PropertyString ProtocolVersion;
bool cloudSave(const char* BucketName);
bool cloudRestore(const char* BucketName);
@@ -141,6 +146,7 @@ private:
Py::Object sCloudTCPPort (const Py::Tuple& args);
Py::Object sCloudSave (const Py::Tuple& args);
Py::Object sCloudRestore (const Py::Tuple& args);
Py::Object sCloudProtocolVersion (const Py::Tuple& args);
};
@@ -178,6 +184,7 @@ protected:
const char* TokenAuth;
const char* TokenSecret;
const char* Bucket;
const char* ProtocolVersion;
std::stringstream FileStream;
};