@abh3 commented on this pull request.

I don't see anything wrong here (famous last words). A couple of comments looking for your reaction and thoughts. Tell me what you think and I'll merge it.


In src/XrdHttp/XrdHttpReq.cc:

> +
+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());

Since the list of xroot supported (i.e. configured) checksums is constructed only once as they cannot change, one could also generate a shadow list that contains a 1-to-1 mapping between xroot names and RFC names. That would allow you to match the user specified name to the shadow list and trivially get the corresponding xroot checksum name. Thus, you can avoid user name conversions,. Since the savings would be trivial compared to computing the checksum, I only ask you consider this approach should it simplify the code. Will it?


In src/XrdHttp/XrdHttpReq.cc:

>   */
-void XrdHttpReq::selectChecksum(const std::string &userDigest, std::string & selectedChecksum) {
-    char * configChecksumList = XrdHttpProtocol::xrd_cslist;
-    selectedChecksum = "unknown";
+void XrdHttpReq::selectXRootDChecksum(const char * configChecksumList, const std::string &userDigest, std::string & xrootdSelectedChecksum) {
+    xrootdSelectedChecksum = "unknown";
     if(configChecksumList != nullptr) {

How would this be possible except when checksums have not been configured and this not supported?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <xrootd/xrootd/pull/1950/review/1334051738@github.com>

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/xrootd/xrootd/pull/1950#pullrequestreview-1334051738", "url": "https://github.com/xrootd/xrootd/pull/1950#pullrequestreview-1334051738", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

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