[gdal-dev] GDAL WMS Timeout

Alex Comer acomer at digitalglobe.com
Fri Nov 13 12:31:15 EST 2009

I am working on a software project which must load data from a WMS
server. To accomplish this, I am planning to use GDALOpen() to open a
GDAL_WMS XML file (by way of the GDAL WMS client driver - see
http://www.gdal.org/frmt_wms.html). In prototypes, this was seen to work
pretty well, however in my project I have a very strict requirement
around the maximum amount of time that may be spent fetching the image
from the WMS. If the fetching process takes any longer than the timeout,
the operation must immediately fail. 


I noticed that the GDAL WMS driver supports a "Timeout" tag in the XML
input parameters which is documented as the "Connection timeout in
seconds. (optional, defaults to 300)". I was hopeful that this parameter
will help me solve the problem, so I examined how this value is used in
the WMS driver and found that it is effectively passed to CURL via the
CURLOPT_TIMEOUT option in gdalhttp.cpp (see
The CURL documentation states that CURLOPT_TIMEOUT specifies the
"maximum time in seconds that you allow the libcurl transfer operation
to take" (see


In the function CPLHTTPFetchMulti() in gdalhttp.cpp, the call is made to
curl_multi_perform(), which appears to do the bulk of the transfer work.
According to my understanding of curl_multi_perform(), if the timeout is
reached then curl_multi_perform() will return, however I don't see any
logic in CPLHTTPFetchMulti() which then aborts the transfer on the
timeout condition. Instead, it appears that the loop will just keep
retrying to download the file. 


As I stated, in my project the operation must abort if the timeout is
reached. Yet based on my analysis of the code in CPLHTTPFetchMulti() it
seems that setting the "Timeout" option is not going to abort the
operation as I require. Am I missing something? Can anyone verify what
kind of semantics we can expect when we set the "Timeout" option? If I
am mistaken, and the GDALOpen() operation is aborted on a timeout
condition, then how can I determine whether the operation failed as a
result of a timeout?


Thanks very much in advance,

Alex Comer



This electronic communication and any attachments may contain confidential and proprietary 
information of DigitalGlobe, Inc. If you are not the intended recipient, or an agent or employee 
responsible for delivering this communication to the intended recipient, or if you have received 
this communication in error, please do not print, copy, retransmit, disseminate or 
otherwise use the information. Please indicate to the sender that you have received this 
communication in error, and delete the copy you received. DigitalGlobe reserves the 
right to monitor any electronic communication sent or received by its employees, agents 
or representatives.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20091113/a52d0990/attachment.html

More information about the gdal-dev mailing list