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,
68 VSIOSSHandleHelper(
const CPLString &osSecretAccessKey,
71 const CPLString &osObjectKey,
bool bUseHTTPS,
72 bool bUseVirtualHosting);
73 ~VSIOSSHandleHelper();
75 static VSIOSSHandleHelper *
76 BuildFromURI(
const char *pszURI,
const char *pszFSPrefix,
77 bool bAllowNoObject,
CSLConstList papszOptions =
nullptr);
80 const CPLString &osObjectKey,
bool bUseHTTPS,
81 bool bUseVirtualHosting);
85 const struct curl_slist *psExistingHeaders,
86 const void *pabyDataContent =
nullptr,
87 size_t nBytesContent = 0)
const override;
89 bool CanRestartOnError(
const char *,
const char *pszHeaders,
90 bool bSetError)
override;
102 return m_osObjectKey;
108 bool GetVirtualHosting()
const
110 return m_bUseVirtualHosting;
113 CPLString GetCopySourceHeader()
const override
115 return "x-oss-copy-source";
118 void SetEndpoint(
const CPLString &osStr);
119 void SetVirtualHosting(
bool b);
124 class VSIOSSUpdateParams
129 explicit VSIOSSUpdateParams(
const VSIOSSHandleHelper *poHelper)
130 : m_osEndpoint(poHelper->GetEndpoint())
134 void UpdateHandlerHelper(VSIOSSHandleHelper *poHelper)
136 poHelper->SetEndpoint(m_osEndpoint);
139 static std::mutex gsMutex;
140 static std::map<CPLString, VSIOSSUpdateParams> goMapBucketsToOSSParams;
143 VSIOSSUpdateParams() =
default;
145 static void UpdateMapFromHandle(VSIOSSHandleHelper *poHandleHelper);
146 static void UpdateHandleFromMap(VSIOSSHandleHelper *poHandleHelper);
147 static void ClearCache();