mirror of
https://github.com/curl/curl.git
synced 2026-08-11 11:51:33 +03:00
lib: make protocol handlers store scheme name lowercase
- saves a lowercase operation when the "[scheme]_proxy" name is generated - appears less "shouting" - update test 970, 972, 1438 and 1536 Closes #13553
This commit is contained in:
parent
848c104639
commit
c294f9cb56
23 changed files with 43 additions and 47 deletions
|
|
@ -68,7 +68,7 @@ static Curl_send rtmp_send;
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_rtmp = {
|
||||
"RTMP", /* scheme */
|
||||
"rtmp", /* scheme */
|
||||
rtmp_setup_connection, /* setup_connection */
|
||||
rtmp_do, /* do_it */
|
||||
rtmp_done, /* done */
|
||||
|
|
@ -92,7 +92,7 @@ const struct Curl_handler Curl_handler_rtmp = {
|
|||
};
|
||||
|
||||
const struct Curl_handler Curl_handler_rtmpt = {
|
||||
"RTMPT", /* scheme */
|
||||
"rtmpt", /* scheme */
|
||||
rtmp_setup_connection, /* setup_connection */
|
||||
rtmp_do, /* do_it */
|
||||
rtmp_done, /* done */
|
||||
|
|
@ -116,7 +116,7 @@ const struct Curl_handler Curl_handler_rtmpt = {
|
|||
};
|
||||
|
||||
const struct Curl_handler Curl_handler_rtmpe = {
|
||||
"RTMPE", /* scheme */
|
||||
"rtmpe", /* scheme */
|
||||
rtmp_setup_connection, /* setup_connection */
|
||||
rtmp_do, /* do_it */
|
||||
rtmp_done, /* done */
|
||||
|
|
@ -140,7 +140,7 @@ const struct Curl_handler Curl_handler_rtmpe = {
|
|||
};
|
||||
|
||||
const struct Curl_handler Curl_handler_rtmpte = {
|
||||
"RTMPTE", /* scheme */
|
||||
"rtmpte", /* scheme */
|
||||
rtmp_setup_connection, /* setup_connection */
|
||||
rtmp_do, /* do_it */
|
||||
rtmp_done, /* done */
|
||||
|
|
@ -164,7 +164,7 @@ const struct Curl_handler Curl_handler_rtmpte = {
|
|||
};
|
||||
|
||||
const struct Curl_handler Curl_handler_rtmps = {
|
||||
"RTMPS", /* scheme */
|
||||
"rtmps", /* scheme */
|
||||
rtmp_setup_connection, /* setup_connection */
|
||||
rtmp_do, /* do_it */
|
||||
rtmp_done, /* done */
|
||||
|
|
@ -188,7 +188,7 @@ const struct Curl_handler Curl_handler_rtmps = {
|
|||
};
|
||||
|
||||
const struct Curl_handler Curl_handler_rtmpts = {
|
||||
"RTMPTS", /* scheme */
|
||||
"rtmpts", /* scheme */
|
||||
rtmp_setup_connection, /* setup_connection */
|
||||
rtmp_do, /* do_it */
|
||||
rtmp_done, /* done */
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done);
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_dict = {
|
||||
"DICT", /* scheme */
|
||||
"dict", /* scheme */
|
||||
ZERO_NULL, /* setup_connection */
|
||||
dict_do, /* do_it */
|
||||
ZERO_NULL, /* done */
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ static CURLcode file_setup_connection(struct Curl_easy *data,
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_file = {
|
||||
"FILE", /* scheme */
|
||||
"file", /* scheme */
|
||||
file_setup_connection, /* setup_connection */
|
||||
file_do, /* do_it */
|
||||
file_done, /* done */
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ static CURLcode ftp_dophase_done(struct Curl_easy *data,
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_ftp = {
|
||||
"FTP", /* scheme */
|
||||
"ftp", /* scheme */
|
||||
ftp_setup_connection, /* setup_connection */
|
||||
ftp_do, /* do_it */
|
||||
ftp_done, /* done */
|
||||
|
|
@ -195,7 +195,7 @@ const struct Curl_handler Curl_handler_ftp = {
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_ftps = {
|
||||
"FTPS", /* scheme */
|
||||
"ftps", /* scheme */
|
||||
ftp_setup_connection, /* setup_connection */
|
||||
ftp_do, /* do_it */
|
||||
ftp_done, /* done */
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ static CURLcode gopher_connecting(struct Curl_easy *data, bool *done);
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_gopher = {
|
||||
"GOPHER", /* scheme */
|
||||
"gopher", /* scheme */
|
||||
ZERO_NULL, /* setup_connection */
|
||||
gopher_do, /* do_it */
|
||||
ZERO_NULL, /* done */
|
||||
|
|
@ -87,7 +87,7 @@ const struct Curl_handler Curl_handler_gopher = {
|
|||
|
||||
#ifdef USE_SSL
|
||||
const struct Curl_handler Curl_handler_gophers = {
|
||||
"GOPHERS", /* scheme */
|
||||
"gophers", /* scheme */
|
||||
ZERO_NULL, /* setup_connection */
|
||||
gopher_do, /* do_it */
|
||||
ZERO_NULL, /* done */
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ static void http_exp100_send_anyway(struct Curl_easy *data);
|
|||
* HTTP handler interface.
|
||||
*/
|
||||
const struct Curl_handler Curl_handler_http = {
|
||||
"HTTP", /* scheme */
|
||||
"http", /* scheme */
|
||||
Curl_http_setup_conn, /* setup_connection */
|
||||
Curl_http, /* do_it */
|
||||
Curl_http_done, /* done */
|
||||
|
|
@ -138,7 +138,7 @@ const struct Curl_handler Curl_handler_http = {
|
|||
* HTTPS handler interface.
|
||||
*/
|
||||
const struct Curl_handler Curl_handler_https = {
|
||||
"HTTPS", /* scheme */
|
||||
"https", /* scheme */
|
||||
Curl_http_setup_conn, /* setup_connection */
|
||||
Curl_http, /* do_it */
|
||||
Curl_http_done, /* done */
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ static CURLcode imap_get_message(struct Curl_easy *data, struct bufref *out);
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_imap = {
|
||||
"IMAP", /* scheme */
|
||||
"imap", /* scheme */
|
||||
imap_setup_connection, /* setup_connection */
|
||||
imap_do, /* do_it */
|
||||
imap_done, /* done */
|
||||
|
|
@ -147,7 +147,7 @@ const struct Curl_handler Curl_handler_imap = {
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_imaps = {
|
||||
"IMAPS", /* scheme */
|
||||
"imaps", /* scheme */
|
||||
imap_setup_connection, /* setup_connection */
|
||||
imap_do, /* do_it */
|
||||
imap_done, /* done */
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done);
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_ldap = {
|
||||
"LDAP", /* scheme */
|
||||
"ldap", /* scheme */
|
||||
ZERO_NULL, /* setup_connection */
|
||||
ldap_do, /* do_it */
|
||||
ZERO_NULL, /* done */
|
||||
|
|
@ -193,7 +193,7 @@ const struct Curl_handler Curl_handler_ldap = {
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_ldaps = {
|
||||
"LDAPS", /* scheme */
|
||||
"ldaps", /* scheme */
|
||||
ZERO_NULL, /* setup_connection */
|
||||
ldap_do, /* do_it */
|
||||
ZERO_NULL, /* done */
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ static CURLcode mqtt_setup_conn(struct Curl_easy *data,
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_mqtt = {
|
||||
"MQTT", /* scheme */
|
||||
"mqtt", /* scheme */
|
||||
mqtt_setup_conn, /* setup_connection */
|
||||
mqtt_do, /* do_it */
|
||||
mqtt_done, /* done */
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ static Curl_recv oldap_recv;
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_ldap = {
|
||||
"LDAP", /* scheme */
|
||||
"ldap", /* scheme */
|
||||
oldap_setup_connection, /* setup_connection */
|
||||
oldap_do, /* do_it */
|
||||
oldap_done, /* done */
|
||||
|
|
@ -146,7 +146,7 @@ const struct Curl_handler Curl_handler_ldap = {
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_ldaps = {
|
||||
"LDAPS", /* scheme */
|
||||
"ldaps", /* scheme */
|
||||
oldap_setup_connection, /* setup_connection */
|
||||
oldap_do, /* do_it */
|
||||
oldap_done, /* done */
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ static CURLcode pop3_get_message(struct Curl_easy *data, struct bufref *out);
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_pop3 = {
|
||||
"POP3", /* scheme */
|
||||
"pop3", /* scheme */
|
||||
pop3_setup_connection, /* setup_connection */
|
||||
pop3_do, /* do_it */
|
||||
pop3_done, /* done */
|
||||
|
|
@ -142,7 +142,7 @@ const struct Curl_handler Curl_handler_pop3 = {
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_pop3s = {
|
||||
"POP3S", /* scheme */
|
||||
"pop3s", /* scheme */
|
||||
pop3_setup_connection, /* setup_connection */
|
||||
pop3_do, /* do_it */
|
||||
pop3_done, /* done */
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ CURLcode rtsp_parse_transport(struct Curl_easy *data, const char *transport);
|
|||
* RTSP handler interface.
|
||||
*/
|
||||
const struct Curl_handler Curl_handler_rtsp = {
|
||||
"RTSP", /* scheme */
|
||||
"rtsp", /* scheme */
|
||||
rtsp_setup_connection, /* setup_connection */
|
||||
rtsp_do, /* do_it */
|
||||
rtsp_done, /* done */
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ static CURLcode smb_parse_url_path(struct Curl_easy *data,
|
|||
* SMB handler interface
|
||||
*/
|
||||
const struct Curl_handler Curl_handler_smb = {
|
||||
"SMB", /* scheme */
|
||||
"smb", /* scheme */
|
||||
smb_setup_connection, /* setup_connection */
|
||||
smb_do, /* do_it */
|
||||
ZERO_NULL, /* done */
|
||||
|
|
@ -287,7 +287,7 @@ const struct Curl_handler Curl_handler_smb = {
|
|||
* SMBS handler interface
|
||||
*/
|
||||
const struct Curl_handler Curl_handler_smbs = {
|
||||
"SMBS", /* scheme */
|
||||
"smbs", /* scheme */
|
||||
smb_setup_connection, /* setup_connection */
|
||||
smb_do, /* do_it */
|
||||
ZERO_NULL, /* done */
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ static CURLcode cr_eob_add(struct Curl_easy *data);
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_smtp = {
|
||||
"SMTP", /* scheme */
|
||||
"smtp", /* scheme */
|
||||
smtp_setup_connection, /* setup_connection */
|
||||
smtp_do, /* do_it */
|
||||
smtp_done, /* done */
|
||||
|
|
@ -148,7 +148,7 @@ const struct Curl_handler Curl_handler_smtp = {
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_smtps = {
|
||||
"SMTPS", /* scheme */
|
||||
"smtps", /* scheme */
|
||||
smtp_setup_connection, /* setup_connection */
|
||||
smtp_do, /* do_it */
|
||||
smtp_done, /* done */
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ struct TELNET {
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_telnet = {
|
||||
"TELNET", /* scheme */
|
||||
"telnet", /* scheme */
|
||||
ZERO_NULL, /* setup_connection */
|
||||
telnet_do, /* do_it */
|
||||
telnet_done, /* done */
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ static CURLcode tftp_translate_code(tftp_error_t error);
|
|||
*/
|
||||
|
||||
const struct Curl_handler Curl_handler_tftp = {
|
||||
"TFTP", /* scheme */
|
||||
"tftp", /* scheme */
|
||||
tftp_setup_connection, /* setup_connection */
|
||||
tftp_do, /* do_it */
|
||||
tftp_done, /* done */
|
||||
|
|
|
|||
11
lib/url.c
11
lib/url.c
|
|
@ -2083,19 +2083,13 @@ static char *detect_proxy(struct Curl_easy *data,
|
|||
* For compatibility, the all-uppercase versions of these variables are
|
||||
* checked if the lowercase versions don't exist.
|
||||
*/
|
||||
char proxy_env[128];
|
||||
const char *protop = conn->handler->scheme;
|
||||
char proxy_env[20];
|
||||
char *envp = proxy_env;
|
||||
#ifdef CURL_DISABLE_VERBOSE_STRINGS
|
||||
(void)data;
|
||||
#endif
|
||||
|
||||
/* Now, build <protocol>_proxy and check for such a one to use */
|
||||
while(*protop)
|
||||
*envp++ = Curl_raw_tolower(*protop++);
|
||||
|
||||
/* append _proxy */
|
||||
strcpy(envp, "_proxy");
|
||||
msnprintf(proxy_env, sizeof(proxy_env), "%s_proxy", conn->handler->scheme);
|
||||
|
||||
/* read the protocol proxy: */
|
||||
proxy = curl_getenv(proxy_env);
|
||||
|
|
@ -2118,7 +2112,6 @@ static char *detect_proxy(struct Curl_easy *data,
|
|||
proxy = curl_getenv(proxy_env);
|
||||
}
|
||||
|
||||
envp = proxy_env;
|
||||
if(!proxy) {
|
||||
#ifdef USE_WEBSOCKETS
|
||||
/* websocket proxy fallbacks */
|
||||
|
|
|
|||
|
|
@ -657,7 +657,7 @@ enum doh_slots {
|
|||
*/
|
||||
|
||||
struct Curl_handler {
|
||||
const char *scheme; /* URL scheme name. */
|
||||
const char *scheme; /* URL scheme name in lowercase */
|
||||
|
||||
/* Complement to setup_connection_internals(). This is done before the
|
||||
transfer "owns" the connection. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue