url: sort the protocol schemes in rough popularity order

When looking for a protocol match among supported schemes, check the
most "popular" schemes first. It has zero functionality difference and
for all practical purposes a speed difference will not be measureable
but it still think it makes sense to put the least likely matches last.

"Popularity" based on the 2019 user survey.

Closes #5377
This commit is contained in:
Daniel Stenberg 2020-05-11 23:18:01 +02:00
Родитель cffbcc3110
Коммит db8866fad9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 5CC908FDB71E12C2
1 изменённых файлов: 39 добавлений и 37 удалений

Просмотреть файл

@ -142,19 +142,21 @@ static unsigned int get_protocol_family(unsigned int protocol);
/*
* Protocol table.
* Protocol table. Schemes (roughly) in 2019 popularity order:
*
* HTTPS, HTTP, FTP, FTPS, SFTP, FILE, SCP, SMTP, LDAP, IMAPS, TELNET, IMAP,
* LDAPS, SMTPS, TFTP, SMB, POP3, GOPHER POP3S, RTSP, RTMP, SMBS, DICT
*/
static const struct Curl_handler * const protocols[] = {
#ifndef CURL_DISABLE_HTTP
&Curl_handler_http,
#endif
#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)
&Curl_handler_https,
#endif
#ifndef CURL_DISABLE_HTTP
&Curl_handler_http,
#endif
#ifndef CURL_DISABLE_FTP
&Curl_handler_ftp,
#endif
@ -163,12 +165,23 @@ static const struct Curl_handler * const protocols[] = {
&Curl_handler_ftps,
#endif
#ifndef CURL_DISABLE_TELNET
&Curl_handler_telnet,
#if defined(USE_SSH)
&Curl_handler_sftp,
#endif
#ifndef CURL_DISABLE_DICT
&Curl_handler_dict,
#ifndef CURL_DISABLE_FILE
&Curl_handler_file,
#endif
#if defined(USE_SSH) && !defined(USE_WOLFSSH)
&Curl_handler_scp,
#endif
#ifndef CURL_DISABLE_SMTP
&Curl_handler_smtp,
#ifdef USE_SSL
&Curl_handler_smtps,
#endif
#endif
#ifndef CURL_DISABLE_LDAP
@ -180,22 +193,6 @@ static const struct Curl_handler * const protocols[] = {
#endif
#endif
#ifndef CURL_DISABLE_FILE
&Curl_handler_file,
#endif
#ifndef CURL_DISABLE_TFTP
&Curl_handler_tftp,
#endif
#if defined(USE_SSH) && !defined(USE_WOLFSSH)
&Curl_handler_scp,
#endif
#if defined(USE_SSH)
&Curl_handler_sftp,
#endif
#ifndef CURL_DISABLE_IMAP
&Curl_handler_imap,
#ifdef USE_SSL
@ -203,6 +200,14 @@ static const struct Curl_handler * const protocols[] = {
#endif
#endif
#ifndef CURL_DISABLE_TELNET
&Curl_handler_telnet,
#endif
#ifndef CURL_DISABLE_TFTP
&Curl_handler_tftp,
#endif
#ifndef CURL_DISABLE_POP3
&Curl_handler_pop3,
#ifdef USE_SSL
@ -219,25 +224,18 @@ static const struct Curl_handler * const protocols[] = {
#endif
#endif
#ifndef CURL_DISABLE_SMTP
&Curl_handler_smtp,
#ifdef USE_SSL
&Curl_handler_smtps,
#endif
#endif
#ifndef CURL_DISABLE_RTSP
&Curl_handler_rtsp,
#endif
#ifndef CURL_DISABLE_GOPHER
&Curl_handler_gopher,
#endif
#ifdef CURL_ENABLE_MQTT
&Curl_handler_mqtt,
#endif
#ifndef CURL_DISABLE_GOPHER
&Curl_handler_gopher,
#endif
#ifdef USE_LIBRTMP
&Curl_handler_rtmp,
&Curl_handler_rtmpt,
@ -247,6 +245,10 @@ static const struct Curl_handler * const protocols[] = {
&Curl_handler_rtmpts,
#endif
#ifndef CURL_DISABLE_DICT
&Curl_handler_dict,
#endif
(struct Curl_handler *) NULL
};