From 4f4df30a4e0a2971b9d728d7f1155c2bce43f862 Mon Sep 17 00:00:00 2001 From: Andreas Kurz Date: Fri, 15 Jun 2018 10:49:47 +0200 Subject: [PATCH] Work around for servers that send unquoted algorithm information --- digest.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/digest.go b/digest.go index 04682ca..2e45873 100644 --- a/digest.go +++ b/digest.go @@ -205,7 +205,12 @@ func digestParts(req *http.Request, resp *http.Response) (res map[string]string) r = strings.TrimSpace(r) for _, w := range wantedHeaders { if strings.Contains(r, w) { - res[w] = strings.Split(r, `"`)[1] + // Some servers send the algorithm without quotes - then split at "=". + if strings.Contains(r, `"`) { + res[w] = strings.Split(r, `"`)[1] + } else { + res[w] = strings.Split(r, "=")[1] + } if w == "qop" { if strings.Contains(res[w], "auth-int") && req.Body != nil { res[w] = "auth-int"