Loading...
Searching...
No Matches
XrdHttpHeaderUtils Class Reference

`#include <XrdHttpHeaderUtils.hh>`

Collaboration diagram for XrdHttpHeaderUtils:

## Static Public Member Functions

static void | parseReprDigest (const std::string &header, std::map< std::string, std::string > &output)

## Detailed Description

Definition at line 29 of file XrdHttpHeaderUtils.hh.

## Member Function Documentation

## parseReprDigest()

void XrdHttpHeaderUtils::parseReprDigest | ( | const std::string & | header,
|  | std::map< std::string, std::string > & | output )

static

Definition at line 30 of file XrdHttpHeaderUtils.cc.

{
// Expected format per entry: <cksumType>=:<digestValue>:
std::vector<std::string> digestNameValuePairs;
XrdOucTUtils::splitString(digestNameValuePairs, header, ",");
for (const auto &digestNameValue : digestNameValuePairs) {
std::string_view digestNameValueSV {digestNameValue};
auto equalPos = digestNameValueSV.find('=');
if (equalPos == std::string::npos || equalPos >= digestNameValueSV.size() - 1)
continue;
std::string_view cksumTypeSV = digestNameValueSV.substr(0, equalPos);
XrdOucUtils::trim(cksumTypeSV);
if (cksumTypeSV.empty())
continue;
std::string_view cksumValueInSV = digestNameValueSV.substr(equalPos + 1);
size_t beginCksumPos = cksumValueInSV.find(':');
size_t endCksumPos = cksumValueInSV.rfind(':');
// Check that the string starts with ':' and contains two distinct colons
if (beginCksumPos == 0 && endCksumPos > beginCksumPos + 1 && endCksumPos < cksumValueInSV.size()) {
std::string_view cksumValue = cksumValueInSV.substr(beginCksumPos + 1, endCksumPos - beginCksumPos - 1);
XrdOucUtils::trim(cksumValue);
if (!cksumValue.empty())
output[std::string(cksumTypeSV)] = cksumValue;
}
// Malformed entries are silently ignored
}
}
XrdOucTUtils::splitString
static void splitString(Container &result, const std::string &input, const std::string &delimiter)
Split a string.
Definition XrdOucTUtils.hh:51
XrdOucUtils::trim
static void trim(std::string &str)
Definition XrdOucUtils.cc:1487

References XrdOucTUtils::splitString(), and XrdOucUtils::trim().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- XrdHttpHeaderUtils.hh
- XrdHttpHeaderUtils.cc