in sdk/src/model/GetObjectRequest.cc [156:214]
HeaderCollection GetObjectRequest::specialHeaders() const
{
auto headers = OssObjectRequest::specialHeaders();
if (rangeIsSet_) {
std::stringstream ss;
ss << "bytes=" << std::to_string(range_[0]) << "-";
if (range_[1] != -1) ss << std::to_string(range_[1]);
headers[Http::RANGE] = ss.str();
if (rangeIsStandardMode_) {
headers["x-oss-range-behavior"] = "standard";
}
}
if (!modifiedSince_.empty())
{
headers["If-Modified-Since"] = modifiedSince_;
}
if (!unmodifiedSince_.empty())
{
headers["If-Unmodified-Since"] = unmodifiedSince_;
}
if (matchingETags_.size() > 0) {
std::stringstream ss;
bool first = true;
for (auto const& str : matchingETags_) {
if (!first) {
ss << ",";
}
ss << str;
first = false;
}
headers["If-Match"] = ss.str();
}
if (nonmatchingETags_.size() > 0) {
std::stringstream ss;
bool first = true;
for (auto const& str : nonmatchingETags_) {
if (!first) {
ss << ",";
}
ss << str;
first = false;
}
headers["If-None-Match"] = ss.str();
}
if (trafficLimit_ != 0) {
headers["x-oss-traffic-limit"] = std::to_string(trafficLimit_);
}
if (!userAgent_.empty()) {
headers[Http::USER_AGENT] = userAgent_;
}
return headers;
}