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);