[gdal-dev] Problems when mixing https calls

Ari Jolma ari.jolma at gmail.com
Mon May 20 12:17:59 PDT 2013


Hi,

I've run into problems when I use https calls from two systems (Perl's 
libww and GDAL) in one program. The use case is WFS with https. First I 
use Perl like this

my $ua = LWP::UserAgent->new;
my $response = $ua->get('https://xxx');

(note that the call does not need to be to the actual WFS, any https 
call is enough to cause a problem and note that this is just using net 
code - the Perl variables may be destroyed completely before we use GDAL)

and then I use GDAL

my $Driver = Geo::OGR::GetDriver('WFS');
my $DataSource = $Driver->Open('WFS:https://xxx', 0);
my $Layer = $DataSource->Layer('xxx');
my $c = $Layer->GetFeatureCount();

During the last command there is a segfault in the bindings of Perl code 
to OpenSSL (surprise!). The segfault does not appear if I remove the 
Perl get call.

My theory is that when I use Perl to access content from a https source 
it leaves a callback to OpenSSL, which is then used for some reason when 
GDAL uses Curl, which uses OpenSSL again.

The Perl bindings code has this comment:

"we intentionally do not implement cleanup of openssl's threading as it 
causes troubles"

This page

http://www.openssl.org/docs/crypto/threads.html

explains about OpenSSL use in multithreaded applications.

Of course it may just be that I'm using a binary OpenSSL, which was 
compiled with different compiler version than what I have (this is Linux 
Mint 64bit).

My question is, is CPL of GDAL doing anything related to OpenSSL (like 
setting callbacks) or is that completely in Curl's domain? Has anybody 
else seen anything like this before?

Cheers,

Ari



More information about the gdal-dev mailing list