curl-library
Re: libcurl protocol handler
Date: Sat, 24 Oct 2009 19:37:43 +0200 (CEST)
On Fri, 23 Oct 2009, Archer King wrote:
> At first, I thought there was a clean separation between the common code and
> protocol specific code (through the use of Curl_handler). But as I dig more
> into the code, I saw some protocol specific logic in the common code. For
> example, I see many "#ifndef CURL_DISABLE_HTTP" and
> "conn->protocol&PROT_HTTP" in transfer.c. I am just wondering why we have
> something like this, is there a specific reason or it is just some legacy
> from older versions?
The intentions are to keep protocol-specific code separate from generic code.
Things such as the Curl_handler struct help out to make it somewhat easy. This
handler struct is fairly new in libcurl land (introduced a few years ago).
Then there's a lot of code that _could_ be moved into the Curl_handler concept
(or similar) to make it more separate, but that haven't because nobody has
bothered to do it yet. Some of the pieces aren't even that easy to split out.
In addition to that, we have a whole lot of #ifdef CURL_DISABLE_* stuff
embedded all over, and they are present to allow people to build libcurl with
specific protocols turned off (mostly to be able to build a smaller library).
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2009-10-24