cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTPS request with curl library gives "out of memory" error

From: Michal Marek <mmarek_at_suse.cz>
Date: Fri, 11 Jan 2008 11:44:30 +0100

Ambarish Mitra wrote:
> --Daniel, Thanks for your response. I have now upgraded the versions of
> both. I am now on curl 7.16.0 and OpenSSL 0.9.8g 19 Oct 2007

That was close, the latest released curl version is 7.17.1 :)

Anyway...

> However, the good part is: in the trace mode, this version of curl gives a
> helpful message, which was not coming in the older version. In the verbose
> mode, the following is printed:
>
> == Info: SSL: couldn't create a context!
>
> I think this is the root cause, but no idea why a SSL context could not be
> created. Any help/pointers would be helpful.

$ grep -n -C3 "couldn't create a context\!" lib/*.c
lib/ssluse.c-1295- connssl->ctx = SSL_CTX_new(req_method);
lib/ssluse.c-1296-
lib/ssluse.c-1297- if(!connssl->ctx) {
lib/ssluse.c:1298: failf(data, "SSL: couldn't create a context!");
lib/ssluse.c-1299- return CURLE_OUT_OF_MEMORY;
lib/ssluse.c-1300- }
lib/ssluse.c-1301-

IOW openSSL's SSL_CTX_new() failed, libcurl interprets this as an out of
memory condition, which may or may not be true (I've never programmed
with openSSL, so I don't know and can't provide a patch right now).

But the problem you're seeing is caused by openSSL. Download the latest
libcurl source, improve the error message in libcurl's ssluse.c to see
what's openSSL really complaining about, fix the issue with openSSL and
post the ssluse.c patch here if you find out that SSL_CTX_new() can
really fail due to other than memory reasons ;)

hth,
Michal
Received on 2008-01-11