merge cloud wb modfications
This commit is contained in:
committed by
wmayer
parent
1ec955a181
commit
287050be41
@@ -25,6 +25,10 @@
|
||||
#ifndef _PreComp_
|
||||
# include <Python.h>
|
||||
#endif
|
||||
#if defined(FC_OS_WIN32)
|
||||
#include <Windows.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/pem.h>
|
||||
@@ -247,11 +251,28 @@ void Cloud::CloudWriter::createBucket()
|
||||
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 AmzData *returnData;
|
||||
struct timeval tv;
|
||||
//struct timeval tv;
|
||||
struct tm *tm;
|
||||
char date_formatted[256];
|
||||
char StringToSign[1024];
|
||||
@@ -265,15 +286,16 @@ struct Cloud::AmzData *Cloud::ComputeDigestAmzS3v2(char *operation, char *data_t
|
||||
|
||||
#if defined(FC_OS_WIN32)
|
||||
_putenv("TZ=GMT");
|
||||
time_t rawtime;
|
||||
|
||||
time(&rawtime);
|
||||
tm = localtime(&rawtime);
|
||||
#else
|
||||
setenv("TZ","GMT",1);
|
||||
#endif
|
||||
#if defined(FC_OS_WIN32)
|
||||
#else
|
||||
gettimeofday(&tv,NULL);
|
||||
gettimeofday(&tv, NULL);
|
||||
tm = localtime(&tv.tv_sec);
|
||||
strftime(date_formatted,256,"%a, %d %b %Y %T %z", tm);
|
||||
#endif
|
||||
strftime(date_formatted,256,"%a, %d %b %Y %T %z", tm);
|
||||
returnData->MD5=NULL;
|
||||
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 )
|
||||
{
|
||||
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);
|
||||
if ( localreader.getLocalReader() != nullptr )
|
||||
{
|
||||
|
||||
@@ -1,48 +1,87 @@
|
||||
#------------------------------ OpenSSL and CURL -------------------------
|
||||
if (APPLE)
|
||||
set(OPENSSL_ROOT_DIR ${HOMEBREW_PREFIX}/Cellar/openssl/*)
|
||||
endif(APPLE)
|
||||
if (UNIX AND NOT APPLE)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_search_module(OPENSSL REQUIRED openssl)
|
||||
else()
|
||||
find_package(OPENSSL REQUIRED)
|
||||
endif(UNIX)
|
||||
if(OPENSSL_FOUND)
|
||||
message(STATUS "openssl-${OPENSSL_VERSION} has been found\n")
|
||||
endif(OPENSSL_FOUND)
|
||||
find_package(CURL REQUIRED)
|
||||
if(CURL_FOUND)
|
||||
message(STATUS "CURL has been found\n")
|
||||
endif(CURL_FOUND)
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
add_subdirectory(App)
|
||||
if(BUILD_GUI)
|
||||
add_subdirectory(Gui)
|
||||
endif(BUILD_GUI)
|
||||
|
||||
set(Cloud_Scripts
|
||||
Init.py
|
||||
)
|
||||
|
||||
if(BUILD_GUI)
|
||||
list (APPEND Cloud_Scripts InitGui.py)
|
||||
endif(BUILD_GUI)
|
||||
|
||||
add_custom_target(CloudScripts ALL
|
||||
SOURCES ${Cloud_Scripts}
|
||||
)
|
||||
|
||||
fc_target_copy_resource_flat(CloudScripts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}/Mod/Cloud
|
||||
${Cloud_Scripts}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${Cloud_Scripts}
|
||||
DESTINATION
|
||||
Mod/Cloud
|
||||
)
|
||||
#------------------------------ OpenSSL and CURL -------------------------
|
||||
if (APPLE)
|
||||
set(OPENSSL_ROOT_DIR ${HOMEBREW_PREFIX}/Cellar/openssl/*)
|
||||
endif(APPLE)
|
||||
if (UNIX AND NOT APPLE)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
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()
|
||||
find_package(OPENSSL REQUIRED)
|
||||
endif(UNIX AND NOT APPLE)
|
||||
if(OPENSSL_FOUND)
|
||||
message(STATUS "openssl-${OPENSSL_VERSION} has been found\n")
|
||||
else()
|
||||
message( FATAL_ERROR "openssl not 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)
|
||||
ENDIF(WIN32)
|
||||
|
||||
|
||||
if(CURL_FOUND)
|
||||
message(STATUS "CURL has been found\n")
|
||||
endif(CURL_FOUND)
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
add_subdirectory(App)
|
||||
if(BUILD_GUI)
|
||||
add_subdirectory(Gui)
|
||||
endif(BUILD_GUI)
|
||||
|
||||
set(Cloud_Scripts
|
||||
Init.py
|
||||
)
|
||||
|
||||
if(BUILD_GUI)
|
||||
list (APPEND Cloud_Scripts InitGui.py)
|
||||
endif(BUILD_GUI)
|
||||
|
||||
add_custom_target(CloudScripts ALL
|
||||
SOURCES ${Cloud_Scripts}
|
||||
)
|
||||
|
||||
fc_target_copy_resource_flat(CloudScripts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}/Mod/Cloud
|
||||
${Cloud_Scripts}
|
||||
)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${Cloud_Scripts}
|
||||
DESTINATION
|
||||
Mod/Cloud
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user