curl / Mailing Lists / curl-library / Single Mail


Is it possible to use some custom functions to send and recv from socket?

From: Bernardo Pastorelli <>
Date: Mon, 9 Jul 2018 14:21:11 +0000

In my application I would like to use a single socket to execute multiple http requests between the client and server, but using a multiplexing implementation that is not the standard HTTP one.

Looking at the source code it appears that libcurl retrains full control on the read and write operations to the socket. Am I missing any alternative that would allow me to gain control of the read and write operations to the socket so that I can add the control bytes required by my multiplexing implementation?

In case I would try to develop a patch that would allow supporting my scenario, which would be the best way to implement it? I was thinking about the capability of registering callbacks for the socket recv and send operations, as it is currently possible for socket open, close and sockopt. The limitation of this approach would be that it would work just for some protocols: for example https delegates the read and write to the socket to the ssl library (for example openssl) or the ldap protocol uses the ldap functions. Anyhow it would work for the plain http protocol. Any other alternative?


Received on 2018-07-09