How to develop http server with libcurl

MOHAMED picture MOHAMED · Feb 13, 2013 · Viewed 12.3k times · Source

I m working with libcurl. It's very good (as client) and I used to open a socket to a server and then send my http packets.

I'm wondering if it's possible to develop http server with the libcurl. the http server will listen on a given port then when it receive a http packet then the http server return a need to a digest authentication.

I made some research in stackoverflow and in the curl website but without result.

Is it possible to do that with libcurl ? and how to do it?

Answer

Daniel Stenberg picture Daniel Stenberg · Feb 13, 2013

To repeat what others have said: no, libcurl is not for servers. It is even said in the curl FAQ:

5.17 Can I write a server with libcurl?

No. libcurl offers no functions or building blocks to build any kind of internet protocol server. libcurl is only a client-side library. For server libraries, you need to continue your search elsewhere but there exist many good open source ones out there for most protocols you could possibly want a server for. And there are really good stand-alone ones that have been tested and proven for many years. There's no need for you to reinvent them!