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

Method getDataByRange

src/basicio.cpp:1449–1469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1447}
1448
1449void HttpIo::HttpImpl::getDataByRange(size_t lowBlock, size_t highBlock, std::string& response) {
1450 Exiv2::Dictionary responseDic;
1451 Exiv2::Dictionary request;
1452 request["server"] = hostInfo_.Host;
1453 request["page"] = hostInfo_.Path;
1454 if (!hostInfo_.Port.empty())
1455 request["port"] = hostInfo_.Port;
1456 request["verb"] = "GET";
1457 std::string errors;
1458 if (lowBlock != std::numeric_limits<size_t>::max() && highBlock != std::numeric_limits<size_t>::max()) {
1459 std::stringstream ss;
1460 ss << "Range: bytes=" << lowBlock * blockSize_ << "-" << ((highBlock + 1) * blockSize_ - 1) << "\r\n";
1461 request["header"] = ss.str();
1462 }
1463
1464 int serverCode = http(request, responseDic, errors);
1465 if (serverCode < 0 || serverCode >= 400 || !errors.empty()) {
1466 throw Error(ErrorCode::kerFileOpenFailed, "http", serverCode, hostInfo_.Path);
1467 }
1468 response = responseDic["body"];
1469}
1470
1471void HttpIo::HttpImpl::writeRemote(const byte* data, size_t size, size_t from, size_t to) {
1472 std::string scriptPath(getEnv(envHTTPPOST));

Callers 1

openMethod · 0.80

Calls 3

ErrorFunction · 0.85
c_strMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected