cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: no custom read() write() callbacks

From: Leon Winter <lwi_at_ring0.de>
Date: Wed, 20 Jan 2010 15:15:53 +0100

Hi,

>> I just caught a quick look at libcurl's source and I spotted probably
>> the spots a patch could be applied best: Curl_read() prefered over
>> Curl_read_plain() since it more highlevel and also Curl_write()
>> instead of send_plain() for the same reason.
>
> I would rather suggest you truly replace read() and write() so you
> make sure the sread() and swrite() function/macro calls are what
> should instead use a function pointer.

Good point, havent seen the macros, this would be best solution.

>> Since we will use real callbacks for the data pushed on tcp session
>> (normal case) we dont need the internal socket anymore. Therefore we
>> must avoid setting it up und destroying it when using this custom
>> callbacks.
>
> Wouldn't you? Well then you speak of other ways of customizations and
> I don't think you necessary should make them happen just because you
> change read and write but they are rather independent. For example we
> already have the CURLOPT_OPENSOCKETFUNCTION that lets you replace the
> socket() call basically.

Good point again, we could indeed use CURLOPT_OPENSOCKETFUNCTION along
with CURLOPT_SOCKOPTDATA to pass our e.g. ssh channel. However there is
no "socket close function callback" atm but also i macro sclose(). Since
we are going to replace sread()/swrite() with callbacks, we should
probably to that with sclose() too.

Hopefully I havent missed something again ;)

Regards,
Leon Winter
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-01-20