cURL / Mailing Lists / curl-library / Single Mail

curl-library

Using an existing OpenSSL connection for libcurl HTTPS requests?

From: Phil Jordan <phil_at_philjordan.eu>
Date: Mon, 22 Mar 2010 14:18:04 +0100

Hi,

We're dealing with some client (legacy) code which makes HTTPS
requests via OpenSSL directly, but the underlying HTTP protocol
implementation is limited to POST requests with hard-wired headers -
it's literally just piecing a couple of fixed strings together with a
custom URL and body. The functionality we need to implement goes well
beyond anything we'd want to do with some hacky HTTP implementation,
and we've had great success using libcurl in the unencrypted areas of
the application, so using it for this seems a good choice.

However, the legacy code does some fairly involved wrangling during
the OpenSSL connection/initialisation phase (don't ask...), and we
need to continue doing that. Picking it to pieces and trying to
squeeze it into a CURLOPT_SSL_CTX_FUNCTION callback looks tricky and
error prone, and we're not even sure it'll work.

Is there a way to hand over a fully initialised, connected and
ready-to-use OpenSSL context to libcurl and let it skip the host
resolution, connection and initialisation phases entirely? If there
isn't such a mechanism by design (we couldn't find one in the docs or
by cursory examination of the code, but who knows), would it be
straightforward to add something like this ourselves, and do you have
any hints on how we might go about it?

Many thanks,

Phil Jordan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-03-22