MCPcopy Index your code
hub / github.com/MapServer/MapServer / msHTTPGetFile

Function msHTTPGetFile

maphttp.c:834–870  ·  view source on GitHub ↗

* msHTTPGetFile() * * Wrapper to call msHTTPExecuteRequests() for a single file. **********************************************************************/

Source from the content-addressed store, hash-verified

832 * Wrapper to call msHTTPExecuteRequests() for a single file.
833 **********************************************************************/
834int msHTTPGetFile(const char *pszGetUrl, const char *pszOutputFile,
835 int *pnHTTPStatus, int nTimeout, int bCheckLocalCache,
836 int bDebug)
837{
838 httpRequestObj *pasReqInfo;
839
840 /* Alloc httpRequestInfo structs through which status of each request
841 * will be returned.
842 * We need to alloc 2 instance of requestobj so that the last
843 * object in the array can be set to NULL.
844 */
845 pasReqInfo = (httpRequestObj*)calloc(2, sizeof(httpRequestObj));
846 MS_CHECK_ALLOC(pasReqInfo, 2*sizeof(httpRequestObj), MS_FAILURE);
847
848 msHTTPInitRequestObj(pasReqInfo, 2);
849
850 pasReqInfo[0].pszGetUrl = msStrdup(pszGetUrl);
851 pasReqInfo[0].pszOutputFile = msStrdup(pszOutputFile);
852 pasReqInfo[0].debug = (char)bDebug;
853
854 if (msHTTPExecuteRequests(pasReqInfo, 1, bCheckLocalCache) != MS_SUCCESS)
855 {
856 *pnHTTPStatus = pasReqInfo[0].nStatus;
857 if (pasReqInfo[0].debug)
858 msDebug("HTTP request failed for %s.\n", pszGetUrl);
859 msHTTPFreeRequestObj(pasReqInfo, 2);
860 free(pasReqInfo);
861 return MS_FAILURE;
862 }
863
864 *pnHTTPStatus = pasReqInfo[0].nStatus;
865
866 msHTTPFreeRequestObj(pasReqInfo, 2);
867 free(pasReqInfo);
868
869 return MS_SUCCESS;
870}
871
872
873#endif /* defined(USE_WMS_LYR) || defined(USE_WMS_SVR) */

Callers 3

msSLDApplySLDURLFunction · 0.85
msLoadMapContextURLFunction · 0.85
msAddImageSymbolFunction · 0.85

Calls 5

msHTTPInitRequestObjFunction · 0.85
msStrdupFunction · 0.85
msHTTPExecuteRequestsFunction · 0.85
msDebugFunction · 0.85
msHTTPFreeRequestObjFunction · 0.85

Tested by

no test coverage detected