[gdal-dev] http driver timeout

Frank Warmerdam warmerdam at pobox.com
Mon Jan 14 16:58:01 EST 2008

Joaquim Luis wrote:
> Hi,
> I'm using the new http driver trough a mex file within Matlab and things 
> work fine ... while I don't have proxy problems.
> The proxy problems is another matter, but when they do occur I have 
> Matlab hanged (it's a very friendly multitask soft) during several 
> minutes until the mex function gives up with a timeout error.
> My question is: is there a way - a runtime parameter or something else - 
> that permits to reduce that waiting time in case of connection failure?


I am not aware of a way for the user to set the timeout for the HTTP driver.
For the WCS driver there is a timeout element in the xml definition file,
but the HTTP driver doesn't have something corresponding.

You could modify the source code to add a mechanism - for instance change
the following code in gdal/port/cpl_http.cpp to include a default timeout
of your selection:

     /* Set timeout.*/
     const char *pszTimeout = CSLFetchNameValue( papszOptions, "TIMEOUT" );
     if( pszTimeout != NULL )
         curl_easy_setopt(http_handle, CURLOPT_TIMEOUT,
                          atoi(pszTimeout) );

There may also be an environment variable recognised by libcurl but I
haven't dug into that in details.  See curl.haxx.se I think.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

More information about the gdal-dev mailing list