Le lundi 18 février 2013 23:49:10, Jeremy Palmer a écrit :
> >> Try setting GDAL_HTTP_PROXY=host:port and
> >> GDAL_HTTP_PROXYUSERPWD=user:pass as environmenet variables /
> >> configuration options.
> 
> Still can't get it to work. Returns:
> 
> ERROR 1: HTTP error code : 407
> ERROR 1: Error returned by server : HTTP error code : 407 (0)
> ERROR 1: HTTP error code : 407
> ERROR 1: Error returned by server : HTTP error code : 407 (0)
> FAILURE:
> Unable to open datasource
> `WFS:http://geoportal.doc.govt.nz/arcgis/services/Geop
> ortalServices/DOC_Tracks/MapServer/WFSServer' with the following drivers.
> 
> Works when I connect via chrome on the same PC.
> 

Perhaps you can try the following attached patch (based on trunk) and after 
rebuilding GDAL also set GDAL_HTTPAUTH=NTLM in addition to GDAL_HTTP_PROXY and 
GDAL_HTTP_PROXYUSERPWD  ?


Index: port/cpl_vsil_curl.cpp
===================================================================
--- port/cpl_vsil_curl.cpp	(révision 25653)
+++ port/cpl_vsil_curl.cpp	(copie de travail)
@@ -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)
Index: port/cpl_vsil_curl_streaming.cpp
===================================================================
--- port/cpl_vsil_curl_streaming.cpp	(révision 25653)
+++ port/cpl_vsil_curl_streaming.cpp	(copie de travail)
@@ -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)
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to