31 #ifndef CPL_ALIBABA_OSS_INCLUDED_H
32 #define CPL_ALIBABA_OSS_INCLUDED_H
42 #include <curl/curl.h>
46 class VSIOSSHandleHelper final:
public IVSIS3LikeHandleHelper
56 bool m_bUseHTTPS =
false;
57 bool m_bUseVirtualHosting =
false;
59 void RebuildURL()
override;
61 static bool GetConfiguration(
const std::string& osPathForOption,
69 VSIOSSHandleHelper(
const CPLString& osSecretAccessKey,
74 bool bUseHTTPS,
bool bUseVirtualHosting);
75 ~VSIOSSHandleHelper();
77 static VSIOSSHandleHelper* BuildFromURI(
const char* pszURI,
78 const char* pszFSPrefix,
84 bool bUseHTTPS,
bool bUseVirtualHosting);
86 struct curl_slist* GetCurlHeaders(
88 const struct curl_slist* psExistingHeaders,
89 const void *pabyDataContent =
nullptr,
90 size_t nBytesContent = 0 )
const override;
92 bool CanRestartOnError(
const char*,
const char* pszHeaders,
94 bool* pbUpdateMap =
nullptr)
override;
96 const CPLString& GetURL()
const override {
return m_osURL; }
97 const CPLString& GetBucket()
const {
return m_osBucket; }
98 const CPLString& GetObjectKey()
const {
return m_osObjectKey; }
99 const CPLString& GetEndpoint()
const {
return m_osEndpoint; }
100 bool GetVirtualHosting()
const {
return m_bUseVirtualHosting; }
102 CPLString GetCopySourceHeader()
const override {
return "x-oss-copy-source"; }
104 void SetEndpoint(
const CPLString &osStr);
105 void SetVirtualHosting(
bool b);
110 class VSIOSSUpdateParams
115 VSIOSSUpdateParams() =
default;
117 explicit VSIOSSUpdateParams(
const VSIOSSHandleHelper* poHelper) :
118 m_osEndpoint(poHelper->GetEndpoint()) {}
120 void UpdateHandlerHelper(VSIOSSHandleHelper* poHelper) {
121 poHelper->SetEndpoint(m_osEndpoint);