| 1447 | } |
| 1448 | |
| 1449 | void 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 | |
| 1471 | void HttpIo::HttpImpl::writeRemote(const byte* data, size_t size, size_t from, size_t to) { |
| 1472 | std::string scriptPath(getEnv(envHTTPPOST)); |