cURL / Mailing Lists / curl-library / Single Mail


Protocol handler tables

From: Patrick Monnerat <>
Date: Wed, 10 Oct 2007 20:42:35 +0200

Hi everyone,
    After looking at the connectdata structure, I noticed there are a
lot of callbacks storage that are only protocol-dependant.
That is: they are set by setup_connection_internals() according to the
URL scheme, and never changed after. In addition, they are always set to
the same values for a given protocol.
By storing these callback pointers (and some parameters) in a
per-protocol static structure (that I called "Curl_handler"), we can:
_ have a single pointer to the Curl_handler in the connectdata
structure, sparing redundant storage.
_ process the protocol setup othogonally, allowing to simply scan a
protocol table to find its handler, thus shortening
_ define these Curl_handlers in the proper source module, improving the
control and the readability of each protocol module,
_ simplify the future addition of new protocol schemes.
The attached patch is a proposal for such a change. No new
functionality. Please tell me what you think about it and if I should
commit it (or fix, modify, throw away, delay to after 7.17.1, etc!). All
comments are welcome. Thanks.

Received on 2007-10-10