From 999568644cd912ec98f389eaf54209221ac4c05e Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 6 Mar 2019 11:18:16 +0100 Subject: [PATCH] Made HTTP authentication scheme case-insensitive. --- lib/http_parser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/http_parser.cpp b/lib/http_parser.cpp index f7eee456..fe62e30d 100644 --- a/lib/http_parser.cpp +++ b/lib/http_parser.cpp @@ -2,6 +2,7 @@ /// Holds all code for the HTTP namespace. #include "http_parser.h" +#include "util.h" #include "auth.h" #include "defines.h" #include "encode.h" @@ -328,11 +329,12 @@ void HTTP::Parser::auth(const std::string &user, const std::string &pass, return; } std::string meth = authReq.substr(0, space); - if (meth == "Basic"){ + Util::stringToLower(meth); + if (meth == "basic"){ SetHeader(headerName, "Basic " + Encodings::Base64::encode(user + ":" + pass)); return; } - if (meth == "Digest"){ + if (meth == "digest"){ std::string realm = findValIn(authReq, "realm"), nonce = findValIn(authReq, "nonce"), opaque = findValIn(authReq, "opaque"), qop = findValIn(authReq, "qop"), algo = findValIn(authReq, "algorithm");