Made HTTP authentication scheme case-insensitive.
This commit is contained in:
parent
d5dbb57c84
commit
999568644c
1 changed files with 4 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
/// Holds all code for the HTTP namespace.
|
/// Holds all code for the HTTP namespace.
|
||||||
|
|
||||||
#include "http_parser.h"
|
#include "http_parser.h"
|
||||||
|
#include "util.h"
|
||||||
#include "auth.h"
|
#include "auth.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
#include "encode.h"
|
#include "encode.h"
|
||||||
|
@ -328,11 +329,12 @@ void HTTP::Parser::auth(const std::string &user, const std::string &pass,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::string meth = authReq.substr(0, space);
|
std::string meth = authReq.substr(0, space);
|
||||||
if (meth == "Basic"){
|
Util::stringToLower(meth);
|
||||||
|
if (meth == "basic"){
|
||||||
SetHeader(headerName, "Basic " + Encodings::Base64::encode(user + ":" + pass));
|
SetHeader(headerName, "Basic " + Encodings::Base64::encode(user + ":" + pass));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (meth == "Digest"){
|
if (meth == "digest"){
|
||||||
std::string realm = findValIn(authReq, "realm"), nonce = findValIn(authReq, "nonce"),
|
std::string realm = findValIn(authReq, "realm"), nonce = findValIn(authReq, "nonce"),
|
||||||
opaque = findValIn(authReq, "opaque"), qop = findValIn(authReq, "qop"),
|
opaque = findValIn(authReq, "opaque"), qop = findValIn(authReq, "qop"),
|
||||||
algo = findValIn(authReq, "algorithm");
|
algo = findValIn(authReq, "algorithm");
|
||||||
|
|
Loading…
Add table
Reference in a new issue