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

@ -29,9 +29,6 @@
extern const struct Curl_protocol Curl_protocol_sftp;
extern const struct Curl_protocol Curl_protocol_scp;
extern const struct Curl_scheme Curl_scheme_sftp;
extern const struct Curl_scheme Curl_scheme_scp;
#ifdef USE_SSH
#ifdef USE_LIBSSH2

View file

@ -331,34 +331,3 @@ CURLcode Curl_ssh_range(struct Curl_easy *data,
}
#endif /* USE_SSH */
/*
* SFTP protocol handler.
*/
const struct Curl_scheme Curl_scheme_sftp = {
"SFTP", /* scheme */
#ifndef USE_SSH
NULL,
#else
&Curl_protocol_sftp,
#endif
CURLPROTO_SFTP, /* protocol */
CURLPROTO_SFTP, /* family */
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION | /* flags */
PROTOPT_NOURLQUERY | PROTOPT_CONN_REUSE,
PORT_SSH /* defport */
};
const struct Curl_scheme Curl_scheme_scp = {
"SCP", /* scheme */
#ifndef USE_SSH
NULL,
#else
&Curl_protocol_scp,
#endif
CURLPROTO_SCP, /* protocol */
CURLPROTO_SCP, /* family */
PROTOPT_DIRLOCK | PROTOPT_CLOSEACTION | /* flags */
PROTOPT_NOURLQUERY | PROTOPT_CONN_REUSE,
PORT_SSH, /* defport */
};