protocol source, all about protocols and uri schemes

Add protocol.h and protocol.c containing all about libcurl's
known URI schemes and their protocol handlers (so they exist).

Moves the scheme definitions from the various sources files into
protocol.c. Schemes are known and used, even of the protocol
handler is not build or just not implemented at all.

Closes #20906
This commit is contained in:
Stefan Eissing 2026-03-12 13:11:38 +01:00 committed by Daniel Stenberg
parent 32531f20f9
commit eb14705280
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
42 changed files with 1089 additions and 992 deletions

View file

@ -1691,7 +1691,7 @@ static CURLcode pop3_setup_connection(struct Curl_easy *data,
/*
* POP3 protocol.
*/
static const struct Curl_protocol Curl_protocol_pop3 = {
const struct Curl_protocol Curl_protocol_pop3 = {
pop3_setup_connection, /* setup_connection */
pop3_do, /* do_it */
pop3_done, /* done */
@ -1712,37 +1712,3 @@ static const struct Curl_protocol Curl_protocol_pop3 = {
};
#endif /* CURL_DISABLE_POP3 */
/*
* POP3 protocol handler.
*/
const struct Curl_scheme Curl_scheme_pop3 = {
"pop3", /* scheme */
#ifdef CURL_DISABLE_POP3
ZERO_NULL,
#else
&Curl_protocol_pop3,
#endif
CURLPROTO_POP3, /* protocol */
CURLPROTO_POP3, /* family */
PROTOPT_CLOSEACTION | PROTOPT_NOURLQUERY | /* flags */
PROTOPT_URLOPTIONS | PROTOPT_SSL_REUSE | PROTOPT_CONN_REUSE,
PORT_POP3, /* defport */
};
/*
* POP3S protocol handler.
*/
const struct Curl_scheme Curl_scheme_pop3s = {
"pop3s", /* scheme */
#if defined(CURL_DISABLE_POP3) || !defined(USE_SSL)
ZERO_NULL,
#else
&Curl_protocol_pop3,
#endif
CURLPROTO_POP3S, /* protocol */
CURLPROTO_POP3, /* family */
PROTOPT_CLOSEACTION | PROTOPT_SSL | /* flags */
PROTOPT_NOURLQUERY | PROTOPT_URLOPTIONS | PROTOPT_CONN_REUSE,
PORT_POP3S, /* defport */
};