| 68 | static int gbCurlInitialized = MS_FALSE; |
| 69 | |
| 70 | int msHTTPInit() |
| 71 | { |
| 72 | /* curl_global_init() should only be called once (no matter how |
| 73 | * many threads or libcurl sessions that'll be used) by every |
| 74 | * application that uses libcurl. |
| 75 | */ |
| 76 | |
| 77 | msAcquireLock(TLOCK_OWS); |
| 78 | if (!gbCurlInitialized && |
| 79 | curl_global_init(CURL_GLOBAL_ALL) != 0) |
| 80 | { |
| 81 | msReleaseLock(TLOCK_OWS); |
| 82 | msSetError(MS_HTTPERR, "Libcurl initialization failed.", |
| 83 | "msHTTPInit()"); |
| 84 | return MS_FAILURE; |
| 85 | } |
| 86 | |
| 87 | gbCurlInitialized = MS_TRUE; |
| 88 | |
| 89 | msReleaseLock(TLOCK_OWS); |
| 90 | return MS_SUCCESS; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | /********************************************************************** |
no test coverage detected