diff options
author | Luboš Doležel <lubos@dolezel.info> | 2020-02-23 09:52:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-23 09:52:25 +0100 |
commit | 0d6553602c1d99adeee0051c091fec5b6e09a4cc (patch) | |
tree | 88d1291a33124f56b7441538547ca53d3a83c471 /src | |
parent | 188bd0606473fee9d7a09e17b9980f7a16d4dc31 (diff) | |
parent | ed606e1323ca7243308237256e80c3a9cb500874 (diff) | |
download | twinkle-0d6553602c1d99adeee0051c091fec5b6e09a4cc.tar twinkle-0d6553602c1d99adeee0051c091fec5b6e09a4cc.tar.gz twinkle-0d6553602c1d99adeee0051c091fec5b6e09a4cc.tar.lz twinkle-0d6553602c1d99adeee0051c091fec5b6e09a4cc.tar.xz twinkle-0d6553602c1d99adeee0051c091fec5b6e09a4cc.zip |
Merge pull request #163 from fbriere/issue/162-multiple-auth-headers
Support multiple WWW-Authenticate/Proxy-Authenticate headers
Diffstat (limited to 'src')
-rw-r--r-- | src/parser/hdr_www_authenticate.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/parser/hdr_www_authenticate.cpp b/src/parser/hdr_www_authenticate.cpp index ae87e99..2deb787 100644 --- a/src/parser/hdr_www_authenticate.cpp +++ b/src/parser/hdr_www_authenticate.cpp @@ -17,10 +17,23 @@ #include "hdr_www_authenticate.h" #include "definitions.h" +#include "util.h" t_hdr_www_authenticate::t_hdr_www_authenticate() : t_header("WWW-Authenticate") {} void t_hdr_www_authenticate::set_challenge(const t_challenge &c) { + // The server may send multiple WWW-Authenticate/Proxy-Authenticate + // headers, with different digest algorithms, in decreasing order of + // preference. We must therefore avoid overwriting any supported + // challenge once we've got a hold of one. (We don't simply ignore + // all unsupported challenges, however, just in case the server forgot + // to include a Digest challenge.) + if (populated) { + // Don't overwrite the previous challenge if it was supported + if (cmp_nocase(challenge.auth_scheme, AUTH_DIGEST) == 0) { + return; + } + } populated = true; challenge = c; } |