MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / getFileLength

Method getFileLength

src/basicio.cpp:1431–1447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1429}
1430
1431int64_t HttpIo::HttpImpl::getFileLength() {
1432 Exiv2::Dictionary response;
1433 Exiv2::Dictionary request;
1434 std::string errors;
1435 request["server"] = hostInfo_.Host;
1436 request["page"] = hostInfo_.Path;
1437 if (!hostInfo_.Port.empty())
1438 request["port"] = hostInfo_.Port;
1439 request["verb"] = "HEAD";
1440 int serverCode = http(request, response, errors);
1441 if (serverCode < 0 || serverCode >= 400 || !errors.empty()) {
1442 throw Error(ErrorCode::kerFileOpenFailed, "http", serverCode, hostInfo_.Path);
1443 }
1444
1445 auto lengthIter = response.find("Content-Length");
1446 return (lengthIter == response.end()) ? -1 : atol((lengthIter->second).c_str());
1447}
1448
1449void HttpIo::HttpImpl::getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) {
1450 Exiv2::Dictionary responseDic;

Callers 1

openMethod · 0.80

Calls 4

ErrorFunction · 0.85
c_strMethod · 0.80
emptyMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected