Skip to content

Commit b61f365

Browse files
committed
Fix #1166
1 parent 33f53aa commit b61f365

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

httplib.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4239,14 +4239,16 @@ inline std::pair<std::string, std::string> make_digest_authentication_header(
42394239
}
42404240
}
42414241

4242-
auto field =
4243-
"Digest username=\"" + username + "\", realm=\"" + auth.at("realm") +
4244-
"\", nonce=\"" + auth.at("nonce") + "\", uri=\"" + req.path +
4245-
"\", algorithm=" + algo +
4246-
(qop.empty() ? ", response=\""
4247-
: ", qop=" + qop + ", nc=\"" + nc + "\", cnonce=\"" +
4248-
cnonce + "\", response=\"") +
4249-
response + "\"";
4242+
auto opaque = (auth.find("opaque") != auth.end()) ? auth.at("opaque") : "";
4243+
4244+
auto field = "Digest username=\"" + username + "\", realm=\"" +
4245+
auth.at("realm") + "\", nonce=\"" + auth.at("nonce") +
4246+
"\", uri=\"" + req.path + "\", algorithm=" + algo +
4247+
(qop.empty() ? ", response=\""
4248+
: ", qop=" + qop + ", nc=" + nc + ", cnonce=\"" +
4249+
cnonce + "\", response=\"") +
4250+
response + "\"" +
4251+
(opaque.empty() ? "" : ", opaque=\"" + opaque + "\"");
42504252

42514253
auto key = is_proxy ? "Proxy-Authorization" : "Authorization";
42524254
return std::make_pair(key, field);

0 commit comments

Comments
 (0)