mirror of https://github.com/openssl/openssl.git
replace if statements in is_valid_uri_char() with switch statement
This commit is contained in:
parent
504a8c5eed
commit
722a2e76e6
|
|
@ -1466,11 +1466,22 @@ int ossl_bio_print_hex(BIO *out, unsigned char *buf, int len)
|
||||||
static int is_valid_uri_char(char c)
|
static int is_valid_uri_char(char c)
|
||||||
{
|
{
|
||||||
/* Valid characters include alphanumeric, '-', '_', '.', '~', and reserved characters */
|
/* Valid characters include alphanumeric, '-', '_', '.', '~', and reserved characters */
|
||||||
return isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~' ||
|
switch (c) {
|
||||||
c == '!'|| c == '$' || c == '&' || c == '\'' || c == '(' ||
|
// Unreserved characters
|
||||||
c == ')' || c == '*' || c == '+' || c == ',' || c == ';' ||
|
case '-': case '_': case '.': case '~':
|
||||||
c == '=' || c == ':' || c == '@' || c == '/' || c == '#' ||
|
// Reserved characters
|
||||||
c == '[' || c == ']' || c == '?';
|
case '!': case '*': case '\'': case '(': case ')':
|
||||||
|
case ';': case ':': case '@': case '&': case '=':
|
||||||
|
case '+': case '$': case ',': case '/': case '?':
|
||||||
|
case '#': case '[': case ']':
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
// Check if alphanumeric
|
||||||
|
if (isalnum(c)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_valid_uri(const char *uri)
|
static int is_valid_uri(const char *uri)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue