summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2016-01-07 14:48:02 +0100
committerMichal Kubecek <mkubecek@suse.cz>2016-01-07 14:48:02 +0100
commit60e8be6ad116896bdd612b7e6aaa5623dc303a4e (patch)
tree1562f61135c4147667b71bf1689d75dbb1b35df6
parent42678b3346f05c3cce3915989b1057785bde989e (diff)
downloadtwinkle-60e8be6ad116896bdd612b7e6aaa5623dc303a4e.tar
twinkle-60e8be6ad116896bdd612b7e6aaa5623dc303a4e.tar.gz
twinkle-60e8be6ad116896bdd612b7e6aaa5623dc303a4e.tar.lz
twinkle-60e8be6ad116896bdd612b7e6aaa5623dc303a4e.tar.xz
twinkle-60e8be6ad116896bdd612b7e6aaa5623dc303a4e.zip
fix build with ucommon 7.0
New version of ucommon adds some restriction to Digest class which break the way twinkle is using it: - proper initialization using constructor is needed - c_str() method is gone; fortunately, str() result can be used to initialize std::string instead Neither of these changes breaks build with ucommon 6.x.
-rw-r--r--src/parser/request.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/parser/request.cpp b/src/parser/request.cpp
index 550a011..348d679 100644
--- a/src/parser/request.cpp
+++ b/src/parser/request.cpp
@@ -207,19 +207,19 @@ bool t_request::authorize_md5(const t_digest_challenge &dchlg,
A2 = method2str(method, unknown_method) + ":" + uri.encode();
A2 += ":";
if (body) {
- digest_t MD5body = "md5";
+ digest_t MD5body("md5");
MD5body.puts(body->encode().c_str());
- A2 += std::string(MD5body.c_str());
+ A2 += std::string(MD5body.str());
} else {
- digest_t MD5body = "md5";
+ digest_t MD5body("md5");
MD5body.puts("");
- A2 += std::string(MD5body.c_str());
+ A2 += std::string(MD5body.str());
}
}
// RFC 2716 3.2.2.1
// Caculate digest
- digest_t MD5A1 = "md5";
- digest_t MD5A2 = "md5";
+ digest_t MD5A1("md5");
+ digest_t MD5A2("md5");
MD5A1.puts(A1.c_str());
MD5A2.puts(A2.c_str());
@@ -227,24 +227,24 @@ bool t_request::authorize_md5(const t_digest_challenge &dchlg,
std::string x;
if (cmp_nocase(qop, QOP_AUTH) == 0 || cmp_nocase(qop, QOP_AUTH_INT) == 0) {
- x = std::string(MD5A1.c_str());
+ x = std::string(MD5A1.str());
x += ":";
x += dchlg.nonce + ":";
x += int2str(nc, "%08x") + ":";
x += cnonce + ":";
x += qop + ":";
- x += std::string(MD5A2.c_str());
+ x += std::string(MD5A2.str());
} else {
- x = std::string(MD5A1.c_str());
+ x = std::string(MD5A1.str());
x += ":";
x += dchlg.nonce + ":";
- x += std::string(MD5A2.c_str());
+ x += std::string(MD5A2.str());
}
- digest_t digest = "md5";
+ digest_t digest("md5");
digest.puts(x.c_str());
- resp = std::string(digest.c_str());
+ resp = std::string(digest.str());
return true;
}