Print

Print


@ccaffy commented on this pull request.



> +
+void XrdHttpReq::extractChecksumFromList(const std::string &checksumList, std::vector<std::string> &extractedChecksum) {
+    XrdOucTUtils::splitString(extractedChecksum,checksumList,",");
+}
+
+void XrdHttpReq::determineXRootDChecksumFromUserDigest(const std::string &userDigest, std::vector<std::string> &xrootdChecksums) {
+    //First, extract the user digests algorithms name
+    //Digests are separated by comas
+    std::vector<std::string> userDigestsVecWithWeights;
+    extractChecksumFromList(userDigest, userDigestsVecWithWeights);
+    //A weight can also be passed by the user for each digest with digestName;q=xx. We just discard them
+    for(auto digestWithWeight: userDigestsVecWithWeights) {
+        std::vector<std::string> currentDigest;
+        XrdOucTUtils::splitString(currentDigest, digestWithWeight, ";");
+        // Don't forget to convert the digest name coming from the user to an XRootD checksum name
+        xrootdChecksums.push_back(convert_digest_name(currentDigest[0]).c_str());

I agree yes! I did not want to modify too much of the existing code. But now that I have some unit tests, I'll refactor the entire thing to extract the logic from this XrdHttpReq class.

I believe there is a need to document this mapping in the XRootD documentation. A user that will configure a sha-512 checksum (with a custom script) will not be able to call the sha-512 checksum in HTTP as the mapping will not match anything. BUT, if they call the checksum sha512 in the config, the mapping will work... I believe this needs to be documented properly to avoid surprises from the user.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/xrootd/xrootd/pull/1950#discussion_r1132082535
You are receiving this because you are subscribed to this thread.

Message ID: <[log in to unmask]>

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1