mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
protocol: use scheme names lowercase
When composing the <scheme>_proxy environment variable, we assume the
handler->scheme name is already lowercase.
This makes unit test 1627 verify that is the case.
Follow-up to c294f9cb56
Spotted by Codex Security
Closes #21033
This commit is contained in:
parent
0b182ae529
commit
6d1d50d65d
@ -359,7 +359,7 @@ const struct Curl_scheme Curl_scheme_rtsp = {
|
||||
};
|
||||
|
||||
const struct Curl_scheme Curl_scheme_sftp = {
|
||||
"SFTP", /* scheme */
|
||||
"sftp", /* scheme */
|
||||
#ifndef USE_SSH
|
||||
NULL,
|
||||
#else
|
||||
@ -373,7 +373,7 @@ const struct Curl_scheme Curl_scheme_sftp = {
|
||||
};
|
||||
|
||||
const struct Curl_scheme Curl_scheme_scp = {
|
||||
"SCP", /* scheme */
|
||||
"scp", /* scheme */
|
||||
#ifndef USE_SSH
|
||||
NULL,
|
||||
#else
|
||||
@ -468,7 +468,7 @@ const struct Curl_scheme Curl_scheme_tftp = {
|
||||
};
|
||||
|
||||
const struct Curl_scheme Curl_scheme_ws = {
|
||||
"WS", /* scheme */
|
||||
"ws", /* scheme */
|
||||
#if defined(CURL_DISABLE_WEBSOCKETS) || defined(CURL_DISABLE_HTTP)
|
||||
ZERO_NULL,
|
||||
#else
|
||||
@ -482,7 +482,7 @@ const struct Curl_scheme Curl_scheme_ws = {
|
||||
};
|
||||
|
||||
const struct Curl_scheme Curl_scheme_wss = {
|
||||
"WSS", /* scheme */
|
||||
"wss", /* scheme */
|
||||
#if defined(CURL_DISABLE_WEBSOCKETS) || defined(CURL_DISABLE_HTTP) || \
|
||||
!defined(USE_SSL)
|
||||
ZERO_NULL,
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
#include "urldata.h"
|
||||
#include "url.h"
|
||||
#include "strcase.h"
|
||||
|
||||
static CURLcode test_unit1627(const char *arg)
|
||||
{
|
||||
@ -68,6 +69,7 @@ static CURLcode test_unit1627(const char *arg)
|
||||
(void)arg;
|
||||
|
||||
for(i = 0; i < CURL_ARRAYSIZE(okay); i++) {
|
||||
char buffer[32];
|
||||
const struct Curl_scheme *get = Curl_get_scheme(okay[i]);
|
||||
if(get) {
|
||||
/* verify that we got the correct scheme */
|
||||
@ -78,6 +80,13 @@ static CURLcode test_unit1627(const char *arg)
|
||||
curl_mprintf("Input: %s, expected okay\n", okay[i]);
|
||||
break;
|
||||
}
|
||||
Curl_strntolower(buffer, okay[i], strlen(okay[i]));
|
||||
buffer[ strlen(okay[i]) ] = 0;
|
||||
if(strcmp(buffer, get->name)) {
|
||||
curl_mprintf("Input: %s is not lowercase: %s\n", buffer, get->name);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
for(j = 0; j < CURL_ARRAYSIZE(notokay); j++) {
|
||||
const struct Curl_scheme *get = Curl_get_scheme(notokay[j]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user