From 4e053680862503bc84e20ddc83fea9167efeb3ce Mon Sep 17 00:00:00 2001 From: yhirose Date: Sat, 11 Sep 2021 14:13:49 -0400 Subject: [PATCH] Fix #1054 --- httplib.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/httplib.h b/httplib.h index 1b1103e..b65a89a 100644 --- a/httplib.h +++ b/httplib.h @@ -4074,11 +4074,14 @@ inline std::pair make_digest_authentication_header( } } - auto field = "Digest username=\"" + username + "\", realm=\"" + - auth.at("realm") + "\", nonce=\"" + auth.at("nonce") + - "\", uri=\"" + req.path + "\", algorithm=" + algo + - ", qop=" + qop + ", nc=\"" + nc + "\", cnonce=\"" + cnonce + - "\", response=\"" + response + "\""; + auto field = + "Digest username=\"" + username + "\", realm=\"" + auth.at("realm") + + "\", nonce=\"" + auth.at("nonce") + "\", uri=\"" + req.path + + "\", algorithm=" + algo + + (qop.empty() ? ", response=\"" + : ", qop=" + qop + ", nc=\"" + nc + "\", cnonce=\"" + + cnonce + "\", response=\"") + + response + "\""; auto key = is_proxy ? "Proxy-Authorization" : "Authorization"; return std::make_pair(key, field);