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:
Daniel Stenberg 2024-05-07 16:55:23 +02:00
parent 848c104639
commit c294f9cb56
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
23 changed files with 43 additions and 47 deletions

View file

@ -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 */