curl-library
Re: use libcurl in a customized environment
Date: Wed, 14 Dec 2016 18:03:46 -0500
Thanks Dan! It sounds very promising.
In my case, I have a customized TLS library which basically provides a read/write interface. Can you shed some more light on how libcurl interact with TLS interface? I guess I’ll need to redefine sread/swrite. Am I right?
Fan
> On Dec 14, 2016, at 3:15 PM, Dan Fandrich <dan_at_coneharvesters.com> wrote:
>
> On Wed, Dec 14, 2016 at 10:44:54AM -0500, Fan Zhang wrote:
>> I’m trying to use libcurl as a HTTP client in a special environment (i.e. Intel SGX for those who cares) where it can not access OS services and can only access socket via a customized shim. I haven’t dived very deep into the source code yet, but I’m wondering how hard it would be to config / refactor libcurl so that I can 1) extract only the HTTP part of it and 2) have it use customized socket APIs? Any suggestion where to start?
>
> libcurl should be almost able to do both without change, depending on how
> customized the socket API is. All but HTTP support can be compiled away using
> the right combination of configure flags (I run some "size-reduced HTTP only"
> autobuilds to make sure it stays working). There are various callback functions
> that can be set to use some custom functions instead of standard socket ones
> (e.g. CURLOPT_OPENSOCKETFUNCTION, CURLOPT_CLOSESOCKETFUNCTION,
> CURLOPT_SOCKOPTFUNCTION). If you use the multi interface, you can supply your
> own poll function. Reading and writing to the socket will still be done using
> read/recv and write/send, so if those have to be customized you'll have to
> replace the corresponding sread/swrite macros at the source level, but that
> should be pretty easy. And if you already have a customized SSL library and
> restrict operations to https only, you might be able to get away with no source
> changes at all.
>
>>>> Dan
> -------------------------------------------------------------------
> List admin: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-12-15