summaryrefslogtreecommitdiff
path: root/lib/vauth
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2022-07-04 08:27:21 +0200
committerDaniel Stenberg <daniel@haxx.se>2022-07-04 08:27:21 +0200
commit193215db3ca956b1e5c99539bc20cf892870d11f (patch)
treefdc48fd4b59b552d58f4e0ee02c80b5a26073221 /lib/vauth
parenta44c9ba79912e3268262a3dc973ead18522a9f98 (diff)
downloadcurl-193215db3ca956b1e5c99539bc20cf892870d11f.tar.gz
digest: simplify a switch() to a simple if
Diffstat (limited to 'lib/vauth')
-rw-r--r--lib/vauth/digest.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/lib/vauth/digest.c b/lib/vauth/digest.c
index b3e4776f1..16171b021 100644
--- a/lib/vauth/digest.c
+++ b/lib/vauth/digest.c
@@ -945,28 +945,18 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
struct digestdata *digest,
char **outptr, size_t *outlen)
{
- switch(digest->algo) {
- case ALGO_MD5:
- case ALGO_MD5SESS:
+ if(digest->algo <= ALGO_MD5SESS)
return auth_create_digest_http_message(data, userp, passwdp,
request, uripath, digest,
outptr, outlen,
auth_digest_md5_to_ascii,
Curl_md5it);
-
- case ALGO_SHA256:
- case ALGO_SHA256SESS:
- case ALGO_SHA512_256:
- case ALGO_SHA512_256SESS:
- return auth_create_digest_http_message(data, userp, passwdp,
- request, uripath, digest,
- outptr, outlen,
- auth_digest_sha256_to_ascii,
- Curl_sha256it);
-
- default:
- return CURLE_UNSUPPORTED_PROTOCOL;
- }
+ DEBUGASSERT(digest->algo <= ALGO_SHA512_256SESS);
+ return auth_create_digest_http_message(data, userp, passwdp,
+ request, uripath, digest,
+ outptr, outlen,
+ auth_digest_sha256_to_ascii,
+ Curl_sha256it);
}
/*