merge cloud wb modfications
This commit is contained in:
committed by
wmayer
parent
1ec955a181
commit
287050be41
@@ -25,6 +25,10 @@
|
|||||||
#ifndef _PreComp_
|
#ifndef _PreComp_
|
||||||
# include <Python.h>
|
# include <Python.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(FC_OS_WIN32)
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <openssl/hmac.h>
|
#include <openssl/hmac.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
@@ -247,11 +251,28 @@ void Cloud::CloudWriter::createBucket()
|
|||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
//#if defined(FC_OS_WIN32)
|
||||||
|
//
|
||||||
|
//#include <chrono>
|
||||||
|
//#undef timezone
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//int gettimeofday( time_t* tp, struct timezone* tzp) {
|
||||||
|
// namespace sc = std::chrono;
|
||||||
|
// sc::system_clock::duration d = sc::system_clock::now().time_since_epoch();
|
||||||
|
// sc::seconds s = sc::duration_cast<sc::seconds>(d);
|
||||||
|
// tp->tv_sec = s.count();
|
||||||
|
// tp->tv_usec = sc::duration_cast<sc::microseconds>(d - s).count();
|
||||||
|
//
|
||||||
|
// return 0;
|
||||||
|
//}
|
||||||
|
//#endif
|
||||||
|
|
||||||
struct Cloud::AmzData *Cloud::ComputeDigestAmzS3v2(char *operation, char *data_type, const char *target, const char *Secret, const char *ptr, long size)
|
struct Cloud::AmzData *Cloud::ComputeDigestAmzS3v2(char *operation, char *data_type, const char *target, const char *Secret, const char *ptr, long size)
|
||||||
{
|
{
|
||||||
struct AmzData *returnData;
|
struct AmzData *returnData;
|
||||||
struct timeval tv;
|
//struct timeval tv;
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
char date_formatted[256];
|
char date_formatted[256];
|
||||||
char StringToSign[1024];
|
char StringToSign[1024];
|
||||||
@@ -265,15 +286,16 @@ struct Cloud::AmzData *Cloud::ComputeDigestAmzS3v2(char *operation, char *data_t
|
|||||||
|
|
||||||
#if defined(FC_OS_WIN32)
|
#if defined(FC_OS_WIN32)
|
||||||
_putenv("TZ=GMT");
|
_putenv("TZ=GMT");
|
||||||
|
time_t rawtime;
|
||||||
|
|
||||||
|
time(&rawtime);
|
||||||
|
tm = localtime(&rawtime);
|
||||||
#else
|
#else
|
||||||
setenv("TZ","GMT",1);
|
setenv("TZ","GMT",1);
|
||||||
#endif
|
gettimeofday(&tv, NULL);
|
||||||
#if defined(FC_OS_WIN32)
|
|
||||||
#else
|
|
||||||
gettimeofday(&tv,NULL);
|
|
||||||
tm = localtime(&tv.tv_sec);
|
tm = localtime(&tv.tv_sec);
|
||||||
strftime(date_formatted,256,"%a, %d %b %Y %T %z", tm);
|
|
||||||
#endif
|
#endif
|
||||||
|
strftime(date_formatted,256,"%a, %d %b %Y %T %z", tm);
|
||||||
returnData->MD5=NULL;
|
returnData->MD5=NULL;
|
||||||
if ( strcmp(operation,"PUT") == 0 )
|
if ( strcmp(operation,"PUT") == 0 )
|
||||||
{
|
{
|
||||||
@@ -895,6 +917,15 @@ void readFiles(Cloud::CloudReader reader, Base::XMLReader *xmlreader)
|
|||||||
if ( reader.isTouched(it->FileName.c_str()) == 0 )
|
if ( reader.isTouched(it->FileName.c_str()) == 0 )
|
||||||
{
|
{
|
||||||
Base::Reader localreader(reader.GetEntry(it->FileName.c_str())->FileStream,it->FileName, xmlreader->FileVersion);
|
Base::Reader localreader(reader.GetEntry(it->FileName.c_str())->FileStream,it->FileName, xmlreader->FileVersion);
|
||||||
|
// for debugging only purpose
|
||||||
|
if ( false )
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << localreader.getStream().rdbuf();
|
||||||
|
auto aString = ss.str();
|
||||||
|
aString = "";
|
||||||
|
}
|
||||||
|
|
||||||
it->Object->RestoreDocFile(localreader);
|
it->Object->RestoreDocFile(localreader);
|
||||||
if ( localreader.getLocalReader() != nullptr )
|
if ( localreader.getLocalReader() != nullptr )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,13 +5,52 @@ endif(APPLE)
|
|||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_search_module(OPENSSL REQUIRED openssl)
|
pkg_search_module(OPENSSL REQUIRED openssl)
|
||||||
|
elseif(WIN32 AND LIBPACK_FOUND)
|
||||||
|
SET( OPENSSL_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include)
|
||||||
|
SET( OPENSSL_LIBRARIES
|
||||||
|
optimized ${FREECAD_LIBPACK_DIR}/lib/openssl.lib debug ${FREECAD_LIBPACK_DIR}/lib/openssld.lib
|
||||||
|
optimized ${FREECAD_LIBPACK_DIR}/lib/libssl.lib debug ${FREECAD_LIBPACK_DIR}/lib/libssld.lib
|
||||||
|
optimized ${FREECAD_LIBPACK_DIR}/lib/libcrypto.lib debug ${FREECAD_LIBPACK_DIR}/lib/libcryptod.lib)
|
||||||
|
if( EXISTS ${FREECAD_LIBPACK_DIR}/lib/openssl.lib)
|
||||||
|
SET( OPENSSL_FOUND True)
|
||||||
|
else()
|
||||||
|
SET( OPENSSL_FOUND False)
|
||||||
|
message( FATAL_ERROR "openssl not found!" )
|
||||||
|
endif(EXISTS ${FREECAD_LIBPACK_DIR}/lib/openssl.lib)
|
||||||
|
|
||||||
|
if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
|
||||||
|
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
|
||||||
|
REGEX "OPENSSL_VERSION_STR")
|
||||||
|
string(REGEX MATCH "\".*"
|
||||||
|
openssl_version_str ${openssl_version_str})
|
||||||
|
string(REPLACE "\"" "" openssl_version_str ${openssl_version_str})
|
||||||
|
set(OPENSSL_VERSION ${openssl_version_str})
|
||||||
|
endif ()
|
||||||
else()
|
else()
|
||||||
find_package(OPENSSL REQUIRED)
|
find_package(OPENSSL REQUIRED)
|
||||||
endif(UNIX)
|
endif(UNIX AND NOT APPLE)
|
||||||
if(OPENSSL_FOUND)
|
if(OPENSSL_FOUND)
|
||||||
message(STATUS "openssl-${OPENSSL_VERSION} has been found\n")
|
message(STATUS "openssl-${OPENSSL_VERSION} has been found\n")
|
||||||
|
else()
|
||||||
|
message( FATAL_ERROR "openssl not found!" )
|
||||||
endif(OPENSSL_FOUND)
|
endif(OPENSSL_FOUND)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
SET( CURL_FOUND True)
|
||||||
|
SET( CURL_INCLUDE_DIR ${FREECAD_LIBPACK_DIR}/include)
|
||||||
|
SET( CURL_LIBRARIES
|
||||||
|
optimized ${FREECAD_LIBPACK_DIR}/lib/libcurl.lib debug ${FREECAD_LIBPACK_DIR}/lib/libcurl_debug.lib)
|
||||||
|
if( EXISTS ${FREECAD_LIBPACK_DIR}/lib/libcurl.lib)
|
||||||
|
SET( CURL_FOUND True)
|
||||||
|
else()
|
||||||
|
SET( CURL_FOUND False)
|
||||||
|
message( FATAL_ERROR "curl not found!" )
|
||||||
|
endif(EXISTS ${FREECAD_LIBPACK_DIR}/lib/libcurl.lib)
|
||||||
|
ELSE()
|
||||||
find_package(CURL REQUIRED)
|
find_package(CURL REQUIRED)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
|
||||||
if(CURL_FOUND)
|
if(CURL_FOUND)
|
||||||
message(STATUS "CURL has been found\n")
|
message(STATUS "CURL has been found\n")
|
||||||
endif(CURL_FOUND)
|
endif(CURL_FOUND)
|
||||||
|
|||||||
Reference in New Issue
Block a user