MCPcopy Create free account
hub / github.com/OSGeo/gdal / GetHTTPFetchContext

Function GetHTTPFetchContext

port/cpl_http.cpp:923–945  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

921/************************************************************************/
922
923static CPLHTTPFetchContext *GetHTTPFetchContext(bool bAlloc)
924{
925 int bError = FALSE;
926 CPLHTTPFetchContext *psCtx = static_cast<CPLHTTPFetchContext *>(
927 CPLGetTLSEx(CTLS_HTTPFETCHCALLBACK, &bError));
928 if (bError)
929 return nullptr;
930
931 if (psCtx == nullptr && bAlloc)
932 {
933 const auto FreeFunc = [](void *pData)
934 { delete static_cast<CPLHTTPFetchContext *>(pData); };
935 psCtx = new CPLHTTPFetchContext();
936 CPLSetTLSWithFreeFuncEx(CTLS_HTTPFETCHCALLBACK, psCtx, FreeFunc,
937 &bError);
938 if (bError)
939 {
940 delete psCtx;
941 psCtx = nullptr;
942 }
943 }
944 return psCtx;
945}
946
947/************************************************************************/
948/* CPLHTTPSetFetchCallback() */

Callers 3

CPLHTTPPushFetchCallbackFunction · 0.85
CPLHTTPPopFetchCallbackFunction · 0.85
CPLHTTPFetchExFunction · 0.85

Calls 2

CPLGetTLSExFunction · 0.85
CPLSetTLSWithFreeFuncExFunction · 0.85

Tested by

no test coverage detected