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

Method CurlImpl

src/basicio.cpp:1578–1595  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1576};
1577
1578CurlIo::CurlImpl::CurlImpl(const std::string& url, size_t blockSize) : Impl(url, blockSize), curl_(curl_easy_init()) {
1579 if (!curl_) {
1580 throw Error(ErrorCode::kerErrorMessage, "Unable to init libcurl.");
1581 }
1582
1583 // The default block size for FTP is much larger than other protocols
1584 // the reason is that getDataByRange() in FTP always creates the new connection,
1585 // so we need the large block size to reduce the overhead of creating the connection.
1586 if (blockSize_ == 0) {
1587 blockSize_ = protocol_ == pFtp ? 102400 : 1024;
1588 }
1589
1590 std::string timeout = getEnv(envTIMEOUT);
1591 timeout_ = atol(timeout.c_str());
1592 if (timeout_ == 0) {
1593 throw Error(ErrorCode::kerErrorMessage, "Timeout Environmental Variable must be a positive integer.");
1594 }
1595}
1596
1597int64_t CurlIo::CurlImpl::getFileLength() {
1598 curl_easy_reset(curl_); // reset all options

Callers

nothing calls this directly

Calls 3

ErrorFunction · 0.85
getEnvFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected