Index: port/cpl_vsil_curl.cpp =================================================================== --- port/cpl_vsil_curl.cpp (revision 25659) +++ port/cpl_vsil_curl.cpp (working copy) @@ -403,6 +403,35 @@ if (CSLTestBoolean(CPLGetConfigOption("CPL_CURL_VERBOSE", "NO"))) curl_easy_setopt(hCurlHandle, CURLOPT_VERBOSE, 1); + const char *pszHttpAuth = CPLGetConfigOption( "GDAL_HTTP_AUTH", NULL ); + if( pszHttpAuth == NULL ) + /* do nothing */; + /* CURLOPT_HTTPAUTH is defined in curl 7.11.0 or newer */ +#if LIBCURL_VERSION_NUM >= 0x70B00 + else if( EQUAL(pszHttpAuth,"BASIC") ) + curl_easy_setopt(hCurlHandle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ); + else if( EQUAL(pszHttpAuth,"NTLM") ) + curl_easy_setopt(hCurlHandle, CURLOPT_HTTPAUTH, CURLAUTH_NTLM ); + else if( EQUAL(pszHttpAuth,"ANY") ) + curl_easy_setopt(hCurlHandle, CURLOPT_HTTPAUTH, CURLAUTH_ANY ); +#ifdef CURLAUTH_GSSNEGOTIATE + else if( EQUAL(pszHttpAuth,"NEGOTIATE") ) + curl_easy_setopt(hCurlHandle, CURLOPT_HTTPAUTH, CURLAUTH_GSSNEGOTIATE ); +#endif + else + { + CPLError( CE_Warning, CPLE_AppDefined, + "Unsupported GDAL_HTTP_AUTH value '%s', ignored.", + pszHttpAuth ); + } +#else + else + { + CPLError( CE_Warning, CPLE_AppDefined, + "GDAL_HTTP_AUTH option needs curl >= 7.11.0" ); + } +#endif + /* Set Proxy parameters */ const char* pszProxy = CPLGetConfigOption("GDAL_HTTP_PROXY", NULL); if (pszProxy) @@ -411,7 +440,35 @@ const char* pszProxyUserPwd = CPLGetConfigOption("GDAL_HTTP_PROXYUSERPWD", NULL); if (pszProxyUserPwd) curl_easy_setopt(hCurlHandle,CURLOPT_PROXYUSERPWD,pszProxyUserPwd); - + + /* Support control over PROXYAUTH */ + const char *pszProxyAuth = CPLGetConfigOption( "GDAL_PROXY_AUTH", NULL ); + if( pszProxyAuth == NULL ) + /* do nothing */; + /* CURLOPT_PROXYAUTH is defined in curl 7.11.0 or newer */ +#if LIBCURL_VERSION_NUM >= 0x70B00 + else if( EQUAL(pszProxyAuth,"BASIC") ) + curl_easy_setopt(hCurlHandle, CURLOPT_PROXYAUTH, CURLAUTH_BASIC ); + else if( EQUAL(pszProxyAuth,"NTLM") ) + curl_easy_setopt(hCurlHandle, CURLOPT_PROXYAUTH, CURLAUTH_NTLM ); + else if( EQUAL(pszProxyAuth,"DIGEST") ) + curl_easy_setopt(hCurlHandle, CURLOPT_PROXYAUTH, CURLAUTH_DIGEST ); + else if( EQUAL(pszProxyAuth,"ANY") ) + curl_easy_setopt(hCurlHandle, CURLOPT_PROXYAUTH, CURLAUTH_ANY ); + else + { + CPLError( CE_Warning, CPLE_AppDefined, + "Unsupported GDAL_PROXY_AUTH value '%s', ignored.", + pszProxyAuth ); + } +#else + else + { + CPLError( CE_Warning, CPLE_AppDefined, + "GDAL_PROXY_AUTH option needs curl >= 7.11.0" ); + } +#endif + /* Enable following redirections. Requires libcurl 7.10.1 at least */ curl_easy_setopt(hCurlHandle, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(hCurlHandle, CURLOPT_MAXREDIRS, 10); Index: port/cpl_vsil_curl_streaming.cpp =================================================================== --- port/cpl_vsil_curl_streaming.cpp (revision 25659) +++ port/cpl_vsil_curl_streaming.cpp (working copy) @@ -358,6 +358,35 @@ if (CSLTestBoolean(CPLGetConfigOption("CPL_CURL_VERBOSE", "NO"))) curl_easy_setopt(hCurlHandle, CURLOPT_VERBOSE, 1); + const char *pszHttpAuth = CPLGetConfigOption( "GDAL_HTTP_AUTH", NULL ); + if( pszHttpAuth == NULL ) + /* do nothing */; + /* CURLOPT_HTTPAUTH is defined in curl 7.11.0 or newer */ +#if LIBCURL_VERSION_NUM >= 0x70B00 + else if( EQUAL(pszHttpAuth,"BASIC") ) + curl_easy_setopt(hCurlHandle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ); + else if( EQUAL(pszHttpAuth,"NTLM") ) + curl_easy_setopt(hCurlHandle, CURLOPT_HTTPAUTH, CURLAUTH_NTLM ); + else if( EQUAL(pszHttpAuth,"ANY") ) + curl_easy_setopt(hCurlHandle, CURLOPT_HTTPAUTH, CURLAUTH_ANY ); +#ifdef CURLAUTH_GSSNEGOTIATE + else if( EQUAL(pszHttpAuth,"NEGOTIATE") ) + curl_easy_setopt(hCurlHandle, CURLOPT_HTTPAUTH, CURLAUTH_GSSNEGOTIATE ); +#endif + else + { + CPLError( CE_Warning, CPLE_AppDefined, + "Unsupported GDAL_HTTP_AUTH value '%s', ignored.", + pszHttpAuth ); + } +#else + else + { + CPLError( CE_Warning, CPLE_AppDefined, + "GDAL_HTTP_AUTH option needs curl >= 7.11.0" ); + } +#endif + /* Set Proxy parameters */ const char* pszProxy = CPLGetConfigOption("GDAL_HTTP_PROXY", NULL); if (pszProxy) @@ -367,6 +396,34 @@ if (pszProxyUserPwd) curl_easy_setopt(hCurlHandle,CURLOPT_PROXYUSERPWD,pszProxyUserPwd); + /* Support control over PROXYAUTH */ + const char *pszProxyAuth = CPLGetConfigOption( "GDAL_PROXY_AUTH", NULL ); + if( pszProxyAuth == NULL ) + /* do nothing */; + /* CURLOPT_PROXYAUTH is defined in curl 7.11.0 or newer */ +#if LIBCURL_VERSION_NUM >= 0x70B00 + else if( EQUAL(pszProxyAuth,"BASIC") ) + curl_easy_setopt(hCurlHandle, CURLOPT_PROXYAUTH, CURLAUTH_BASIC ); + else if( EQUAL(pszProxyAuth,"NTLM") ) + curl_easy_setopt(hCurlHandle, CURLOPT_PROXYAUTH, CURLAUTH_NTLM ); + else if( EQUAL(pszProxyAuth,"DIGEST") ) + curl_easy_setopt(hCurlHandle, CURLOPT_PROXYAUTH, CURLAUTH_DIGEST ); + else if( EQUAL(pszProxyAuth,"ANY") ) + curl_easy_setopt(hCurlHandle, CURLOPT_PROXYAUTH, CURLAUTH_ANY ); + else + { + CPLError( CE_Warning, CPLE_AppDefined, + "Unsupported GDAL_PROXY_AUTH value '%s', ignored.", + pszProxyAuth ); + } +#else + else + { + CPLError( CE_Warning, CPLE_AppDefined, + "GDAL_PROXY_AUTH option needs curl >= 7.11.0" ); + } +#endif + /* Enable following redirections. Requires libcurl 7.10.1 at least */ curl_easy_setopt(hCurlHandle, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(hCurlHandle, CURLOPT_MAXREDIRS, 10); Index: port/cpl_http.cpp =================================================================== --- port/cpl_http.cpp (revision 25659) +++ port/cpl_http.cpp (working copy) @@ -127,6 +127,7 @@ *