380 if (m_recv_all_headers) {
381 m_recv_all_headers =
false;
382 m_recv_status_line =
false;
385 if (!m_recv_status_line) {
386 m_recv_status_line =
true;
388 std::stringstream ss(header_line);
390 if (!std::getline(ss, item,
' '))
return false;
391 m_resp_protocol = item;
392 if (!std::getline(ss, item,
' '))
return false;
394 m_status_code = std::stol(item);
398 if (m_status_code < 100 || m_status_code >= 600) {
401 if (!std::getline(ss, item,
'\n'))
return false;
402 auto cr_loc = item.find(
'\r');
403 if (cr_loc != std::string::npos) {
404 m_resp_message = item.substr(0, cr_loc);
406 m_resp_message = item;
411 if (header_line.empty() || header_line ==
"\n" || header_line ==
"\r\n") {
412 m_recv_all_headers =
true;
416 auto found = header_line.find(
":");
417 if (found == std::string::npos) {
421 std::string header_name = header_line.substr(0, found);
427 while (found < header_line.size()) {
428 if (header_line[found] !=
' ') {
break;}
431 std::string header_value = header_line.substr(found);
434 header_value.erase(header_value.find_last_not_of(
" \r\n\t") + 1);
438 auto iter = m_headers.find(header_name);
439 if (iter == m_headers.end()) {
440 m_headers.insert(iter, {header_name, {header_value}});
442 iter->second.push_back(header_value);
445 if (header_name ==
"Allow") {
446 std::string_view val(header_value);
447 while (!val.empty()) {
448 auto found = val.find(
',');
449 auto method = val.substr(0, found);
450 if (method ==
"PROPFIND") {
454 if (found == std::string_view::npos)
break;
455 val = val.substr(found + 1);
460 }
else if (header_name ==
"Content-Length") {
462 m_content_length = std::stoll(header_value);
467 else if (header_name ==
"Content-Type") {
468 std::string_view val(header_value);
469 auto found = val.find(
";");
470 auto first_type = val.substr(0, found);
471 m_multipart_byteranges = first_type ==
"multipart/byteranges";
472 if (m_multipart_byteranges) {
473 auto remainder = val.substr(found + 1);
474 found = remainder.find(
"boundary=");
475 if (found != std::string_view::npos) {
480 else if (header_name ==
"Content-Range") {
481 auto found = header_value.find(
" ");
482 if (found == std::string::npos) {
485 std::string range_unit = header_value.substr(0, found);
486 if (range_unit !=
"bytes") {
489 auto range_resp = header_value.substr(found + 1);
490 found = range_resp.find(
"/");
491 if (found == std::string::npos) {
494 auto incl_range = range_resp.substr(0, found);
495 found = incl_range.find(
"-");
496 if (found == std::string::npos) {
499 auto first_pos = incl_range.substr(0, found);
501 m_response_offset = std::stoll(first_pos);
505 auto last_pos = incl_range.substr(found + 1);
508 last_byte = std::stoll(last_pos);
512 m_content_length = last_byte - m_response_offset + 1;
514 else if (header_name ==
"Location") {
515 m_location = header_value;
516 }
else if (header_name ==
"Digest") {
519 else if (header_name ==
"Etag")
523 m_etag = header_value;
524 m_etag.erase(remove(m_etag.begin(), m_etag.end(),
'\"'), m_etag.end());
526 else if (header_name ==
"Cache-Control")
528 m_cache_control = header_value;
1059 auto now = std::chrono::system_clock::now().time_since_epoch().count();
1060 auto oldest_op = now;
1061 auto oldest_cycle = now;
1063 std::unique_lock lk(m_worker_stats_mutex);
1064 for (
const auto &entry : m_workers_last_completed_cycle) {
1065 if (!entry) {
continue;}
1066 auto cycle = entry->load(std::memory_order_relaxed);
1067 if (cycle < oldest_cycle) oldest_cycle = cycle;
1069 for (
const auto &entry : m_workers_oldest_op) {
1070 if (!entry) {
continue;}
1071 auto op = entry->load(std::memory_order_relaxed);
1072 if (op < oldest_op) oldest_op = op;
1075 auto oldest_op_dbl = std::chrono::duration<double>(std::chrono::system_clock::time_point(std::chrono::system_clock::duration(oldest_op)).time_since_epoch()).count();
1076 auto oldest_cycle_dbl = std::chrono::duration<double>(std::chrono::system_clock::time_point(std::chrono::system_clock::duration(oldest_cycle)).time_since_epoch()).count();
1077 std::string retval =
"{"
1078 "\"oldest_op\":" + std::to_string(oldest_op_dbl) +
","
1079 "\"oldest_cycle\":" + std::to_string(oldest_cycle_dbl) +
","
1082 for (
size_t verb_idx = 0; verb_idx < static_cast<int>(XrdClHttp::CurlOperation::HttpVerb::Count); verb_idx++) {
1084 for (
size_t op_idx = 0; op_idx < 402; op_idx++) {
1085 if (op_idx == 401)
continue;
1087 auto &op_stats = m_ops[verb_idx][op_idx];
1088 auto duration = op_stats.m_duration.load(std::memory_order_relaxed);
1089 if (duration == 0)
continue;
1091 std::string prefix =
"http_" + verb_str +
"_" + ((op_idx == 402) ?
"invalid" : std::to_string(200 + op_idx)) +
"_";
1093 auto duration_dbl = std::chrono::duration<double>(std::chrono::steady_clock::duration(duration)).count();
1094 retval +=
"\"" + prefix +
"duration\":" + std::to_string(duration_dbl) +
",";
1096 duration = op_stats.m_pause_duration.load(std::memory_order_relaxed);
1098 duration_dbl = std::chrono::duration<double>(std::chrono::steady_clock::duration(duration)).count();
1099 retval +=
"\"" + prefix +
"pause_duration\":" + std::to_string(duration_dbl) +
",";
1102 auto count = op_stats.m_bytes.load(std::memory_order_relaxed);
1103 if (count) retval +=
"\"" + prefix +
"bytes\":" + std::to_string(count) +
",";
1104 count = op_stats.m_error.load(std::memory_order_relaxed);
1105 if (count) retval +=
"\"" + prefix +
"error\":" + std::to_string(count) +
",";
1106 count = op_stats.m_finished.load(std::memory_order_relaxed);
1107 if (count) retval +=
"\"" + prefix +
"finished\":" + std::to_string(count) +
",";
1108 count = op_stats.m_client_timeout.load(std::memory_order_relaxed);
1109 if (count) retval +=
"\"" + prefix +
"client_timeout\":" + std::to_string(count) +
",";
1110 count = op_stats.m_server_timeout.load(std::memory_order_relaxed);
1111 if (count) retval +=
"\"" + prefix +
"server_timeout\":" + std::to_string(count) +
",";
1114 auto &op_stats = m_ops[verb_idx][401];
1115 auto duration = op_stats.m_duration.load(std::memory_order_relaxed);
1116 if (duration == 0)
continue;
1118 std::string prefix =
"http_" + verb_str +
"_";
1120 auto duration_dbl = std::chrono::duration<double>(std::chrono::steady_clock::duration(duration)).count();
1121 retval +=
"\"" + prefix +
"preheader_duration\":" + std::to_string(duration_dbl) +
",";
1123 auto count = op_stats.m_started.load(std::memory_order_relaxed);
1124 if (count) retval +=
"\"" + prefix +
"started\":" + std::to_string(count) +
",";
1125 count = op_stats.m_error.load(std::memory_order_relaxed);
1126 if (count) retval +=
"\"" + prefix +
"preheader_error\":" + std::to_string(count) +
",";
1127 count = op_stats.m_finished.load(std::memory_order_relaxed);
1128 if (count) retval +=
"\"" + prefix +
"preheader_finished\":" + std::to_string(count) +
",";
1129 count = op_stats.m_server_timeout.load(std::memory_order_relaxed);
1130 if (count) retval +=
"\"" + prefix +
"preheader_timeout\":" + std::to_string(count) +
",";
1131 count = op_stats.m_conncall_timeout.load(std::memory_order_relaxed);
1132 if (count) retval +=
"\"" + prefix +
"conncall_timeout\":" + std::to_string(count) +
",";
1137 "\"conncall_error\":" + std::to_string(m_conncall_errors.load(std::memory_order_relaxed)) +
","
1138 "\"conncall_started\":" + std::to_string(m_conncall_req.load(std::memory_order_relaxed)) +
","
1139 "\"conncall_success\":" + std::to_string(m_conncall_success.load(std::memory_order_relaxed)) +
","
1140 "\"conncall_timeout\":" + std::to_string(m_conncall_timeout.load(std::memory_order_relaxed)) +
1227 int max_pending = 50;
1230 auto &queue = *m_queue.get();
1233 CURLM *multi_handle = curl_multi_init();
1234 if (multi_handle ==
nullptr) {
1235 throw std::runtime_error(
"Failed to create curl multi-handle");
1238 int running_handles = 0;
1239 time_t last_maintenance = time(NULL);
1240 CURLMcode mres = CURLM_OK;
1244 std::unordered_map<int, WaitingForBroker> broker_reqs;
1245 std::vector<struct curl_waitfd> waitfds;
1247 bool want_shutdown =
false;
1248 while (!want_shutdown) {
1249 m_last_completed_cycle.store(std::chrono::system_clock::now().time_since_epoch().count());
1250 auto oldest_op = std::chrono::system_clock::now();
1251 for (
const auto &entry : m_op_map) {
1252 OpRecord(*entry.second.first, OpKind::Update);
1253 if (entry.second.second < oldest_op) {
1254 oldest_op = entry.second.second;
1257 m_oldest_op.store(oldest_op.time_since_epoch().count());
1261 auto op = m_continue_queue->TryConsume();
1268 m_logger->Debug(
kLogXrdClHttp,
"Ignoring continuation of operation that has already completed");
1271 m_logger->Debug(
kLogXrdClHttp,
"Continuing the curl handle from op %p on thread %d", op.get(), getthreadid());
1275 OpRecord(*op, OpKind::Error);
1278 curl_multi_remove_handle(multi_handle, curl);
1279 curl_easy_cleanup(curl);
1280 m_op_map.erase(curl);
1282 running_handles -= 1;
1285 auto iter = m_op_map.find(curl);
1286 if (iter != m_op_map.end()) iter->second.second = std::chrono::system_clock::now();
1290 while (running_handles <
static_cast<int>(m_max_ops)) {
1291 auto op = running_handles == 0 ? queue.Consume(std::chrono::seconds(1)) : queue.TryConsume();
1295 auto curl = queue.GetHandle();
1296 if (curl ==
nullptr) {
1297 m_logger->Debug(
kLogXrdClHttp,
"Unable to allocate a curl handle");
1302 auto rv = op->
Setup(curl, *
this);
1304 m_logger->Debug(
kLogXrdClHttp,
"Failed to setup the curl handle");
1309 m_logger->Debug(
kLogXrdClHttp,
"Failed to finish setup of the curl handle");
1314 m_logger->Debug(
kLogXrdClHttp,
"Unable to setup the curl handle");
1322 queue.RecycleHandle(curl);
1325 m_op_map[curl] = {op, std::chrono::system_clock::now()};
1330 std::string modified_url;
1331 std::shared_ptr<CurlOptionsOp> options_op(
1343 curl = queue.GetHandle();
1344 if (curl ==
nullptr) {
1345 m_logger->Debug(
kLogXrdClHttp,
"Unable to allocate a curl handle");
1347 OpRecord(*op, OpKind::Error);
1350 auto rv = options_op->Setup(curl, *
this);
1352 m_logger->Debug(
kLogXrdClHttp,
"Failed to allocate a curl handle for OPTIONS");
1355 m_op_map[curl] = {options_op, std::chrono::system_clock::now()};
1356 OpRecord(*options_op, OpKind::Start);
1357 running_handles += 1;
1359 OpRecord(*op, OpKind::Start);
1362 auto mres = curl_multi_add_handle(multi_handle, curl);
1363 if (mres != CURLM_OK) {
1364 m_logger->Debug(
kLogXrdClHttp,
"Unable to add operation to the curl multi-handle");
1366 OpRecord(*op, OpKind::Error);
1369 m_logger->Debug(
kLogXrdClHttp,
"Added request for URL %s to worker thread for processing", op->
GetUrl().c_str());
1370 running_handles += 1;
1375 time_t now = time(NULL);
1376 time_t next_maintenance = last_maintenance + m_maintenance_period.load(std::memory_order_relaxed);
1377 if (now >= next_maintenance) {
1379 m_continue_queue->Expire();
1380 m_logger->Debug(
kLogXrdClHttp,
"Curl worker thread %d is running %d operations",
1381 getthreadid(), running_handles);
1382 last_maintenance = now;
1385 std::vector<std::pair<int, CURL *>> expired_ops;
1386 for (
const auto &entry : broker_reqs) {
1387 if (entry.second.expiry < now) {
1388 expired_ops.emplace_back(entry.first, entry.second.curl);
1391 for (
const auto &entry : expired_ops) {
1392 auto iter = m_op_map.find(entry.second);
1393 if (iter == m_op_map.end()) {
1394 m_logger->Warning(
kLogXrdClHttp,
"Found an expired curl handle with no corresponding operation!");
1398 if ((options_op =
dynamic_cast<CurlOptionsOp*
>(iter->second.first.get())) !=
nullptr) {
1400 bool parent_op_failed =
false;
1401 if (parent_op->IsRedirect()) {
1405 if (iter != m_op_map.end()) {
1406 OpRecord(*iter->second.first, OpKind::Error);
1408 m_op_map.erase(iter);
1409 running_handles -= 1;
1411 parent_op_failed =
true;
1413 OpRecord(*parent_op, OpKind::Start);
1416 OpRecord(*parent_op, OpKind::Start);
1418 if (!parent_op_failed){
1424 iter->second.first->ReleaseHandle();
1425 OpRecord(*(iter->second.first), OpKind::ConncallTimeout);
1426 m_op_map.erase(entry.second);
1427 curl_easy_cleanup(entry.second);
1428 running_handles -= 1;
1430 broker_reqs.erase(entry.first);
1431 m_conncall_timeout.fetch_add(1, std::memory_order_relaxed);
1439 waitfds.resize(3 + broker_reqs.size());
1441 waitfds[0].fd = queue.PollFD();
1442 waitfds[0].events = CURL_WAIT_POLLIN;
1443 waitfds[0].revents = 0;
1444 waitfds[1].fd = m_continue_queue->PollFD();
1445 waitfds[1].events = CURL_WAIT_POLLIN;
1446 waitfds[1].revents = 0;
1447 waitfds[2].fd = m_shutdown_pipe_r;
1448 waitfds[2].revents = 0;
1449 waitfds[2].events = CURL_WAIT_POLLIN | CURL_WAIT_POLLPRI;
1452 for (
const auto &entry : broker_reqs) {
1453 waitfds[idx].fd = entry.first;
1454 waitfds[idx].events = CURL_WAIT_POLLIN|CURL_WAIT_POLLPRI;
1455 waitfds[idx].revents = 0;
1460 curl_multi_timeout(multi_handle, &timeo);
1464 if (running_handles && timeo == -1) {
1469 mres = curl_multi_wait(multi_handle, &waitfds[0], waitfds.size(), 50,
nullptr);
1475 mres = curl_multi_wait(multi_handle, &waitfds[0], waitfds.size(), 50,
nullptr);
1477 if (mres != CURLM_OK) {
1478 m_logger->Warning(
kLogXrdClHttp,
"Failed to wait on multi-handle: %d", mres);
1482 for (
const auto &entry : waitfds) {
1484 if (waitfds[0].fd == entry.fd || waitfds[1].fd == entry.fd) {
1488 if ((waitfds[2].fd == entry.fd) && entry.revents) {
1489 want_shutdown =
true;
1492 if ((entry.revents & CURL_WAIT_POLLIN) != CURL_WAIT_POLLIN) {
1495 auto handle = broker_reqs[entry.fd].curl;
1496 auto iter = m_op_map.find(handle);
1497 if (iter == m_op_map.end()) {
1498 m_logger->Warning(
kLogXrdClHttp,
"Internal error: broker responded on FD %d but no corresponding curl operation", entry.fd);
1499 broker_reqs.erase(entry.fd);
1500 m_conncall_errors.fetch_add(1, std::memory_order_relaxed);
1504 auto result = iter->second.first->WaitSocketCallback(err);
1506 m_logger->Warning(
kLogXrdClHttp,
"Error when invoking the broker callback: %s", err.c_str());
1509 if ((options_op =
dynamic_cast<CurlOptionsOp*
>(iter->second.first.get())) !=
nullptr) {
1511 bool parent_op_failed =
false;
1512 if (parent_op->IsRedirect()) {
1516 if (iter != m_op_map.end()) {
1517 OpRecord(*iter->second.first, OpKind::Error);
1519 m_op_map.erase(iter);
1520 running_handles -= 1;
1522 parent_op_failed =
true;
1524 OpRecord(*parent_op, OpKind::Start);
1527 OpRecord(*parent_op, OpKind::Start);
1529 if (!parent_op_failed){
1535 OpRecord(*iter->second.first, OpKind::Error);
1536 m_op_map.erase(handle);
1537 broker_reqs.erase(entry.fd);
1538 m_conncall_errors.fetch_add(1, std::memory_order_relaxed);
1539 running_handles -= 1;
1541 broker_reqs.erase(entry.fd);
1542 curl_multi_add_handle(multi_handle, handle);
1543 m_conncall_success.fetch_add(1, std::memory_order_relaxed);
1549 auto mres = curl_multi_perform(multi_handle, &still_running);
1550 if (mres == CURLM_CALL_MULTI_PERFORM) {
1552 }
else if (mres != CURLM_OK) {
1553 m_logger->Warning(
kLogXrdClHttp,
"Failed to perform multi-handle operation: %d", mres);
1560 msg = curl_multi_info_read(multi_handle, &msgq);
1561 if (msg && (msg->msg == CURLMSG_DONE)) {
1562 if (!msg->easy_handle) {
1563 m_logger->Warning(
kLogXrdClHttp,
"Logic error: got a callback for a null handle");
1564 mres = CURLM_BAD_EASY_HANDLE;
1567 auto iter = m_op_map.find(msg->easy_handle);
1568 if (iter == m_op_map.end()) {
1569 m_logger->Error(
kLogXrdClHttp,
"Logic error: got a callback for an entry that doesn't exist");
1570 mres = CURLM_BAD_EASY_HANDLE;
1573 auto op = iter->second.first;
1574 auto res = msg->data.result;
1575 bool keep_handle =
false;
1576 bool waiting_on_callout =
false;
1577 if (res == CURLE_OK) {
1579 OpRecord(*op, OpKind::Finish);
1588 if ((options_op =
dynamic_cast<CurlOptionsOp*
>(op.get())) !=
nullptr) {
1590 bool parent_op_failed =
false;
1591 if (parent_op->IsRedirect()) {
1594 OpRecord(*parent_op, OpKind::Error);
1596 running_handles -= 1;
1597 parent_op_failed =
true;
1599 OpRecord(*parent_op, OpKind::Start);
1602 OpRecord(*parent_op, OpKind::Start);
1605 if (!parent_op_failed) {
1610 queue.RecycleHandle(iter->first);
1614 if ((options_op =
dynamic_cast<CurlOptionsOp*
>(op.get()))) {
1620 OpRecord(*op, OpKind::Start);
1622 curl_multi_remove_handle(multi_handle, iter->first);
1623 queue.RecycleHandle(iter->first);
1638 OpRecord(*op, OpKind::Error);
1640 keep_handle =
false;
1648 OpRecord(*op, OpKind::Start);
1658 std::string modified_url;
1661 std::shared_ptr<CurlOperation> new_op(options_op);
1662 auto curl = queue.GetHandle();
1663 if (curl ==
nullptr) {
1664 m_logger->Debug(
kLogXrdClHttp,
"Unable to allocate a curl handle");
1666 keep_handle =
false;
1667 options_op =
nullptr;
1670 OpRecord(*new_op, OpKind::Start);
1672 auto rv = new_op->Setup(curl, *
this);
1674 m_logger->Debug(
kLogXrdClHttp,
"Unable to configure a curl handle for OPTIONS");
1675 keep_handle =
false;
1676 options_op =
nullptr;
1680 m_logger->Debug(
kLogXrdClHttp,
"Unable to setup the curl handle for the OPTIONS operation");
1681 new_op->Fail(
XrdCl::errInternal, ENOMEM,
"Failed to setup the curl handle for the OPTIONS operation");
1682 OpRecord(*new_op, OpKind::Error);
1683 keep_handle =
false;
1686 new_op->SetContinueQueue(m_continue_queue);
1687 m_op_map[curl] = {new_op, std::chrono::system_clock::now()};
1688 auto mres = curl_multi_add_handle(multi_handle, curl);
1689 if (mres != CURLM_OK) {
1690 m_logger->Debug(
kLogXrdClHttp,
"Unable to add OPTIONS operation to the curl multi-handle: %s", curl_multi_strerror(mres));
1692 OpRecord(*new_op, OpKind::Error);
1695 running_handles += 1;
1696 m_logger->Debug(
kLogXrdClHttp,
"Invoking the OPTIONS operation before redirect to %s", target.c_str());
1703 if ((waiting_on_callout = callout_socket >= 0)) {
1704 auto expiry = time(
nullptr) + 20;
1705 m_logger->Debug(
kLogXrdClHttp,
"Creating a callout wait request on socket %d", callout_socket);
1706 broker_reqs[callout_socket] = {iter->first, expiry};
1707 m_conncall_req.fetch_add(1, std::memory_order_relaxed);
1709 }
else if (options_op) {
1714 curl_multi_remove_handle(multi_handle, iter->first);
1715 if (!waiting_on_callout && !options_op) {
1716 curl_multi_add_handle(multi_handle, iter->first);
1718 }
else if (!options_op) {
1723 curl_multi_remove_handle(multi_handle, iter->first);
1728 queue.RecycleHandle(iter->first);
1734 auto next_res = curl_multi_add_handle(multi_handle, iter->first);
1735 if (next_res == CURLM_OK) {
1737 OpRecord(*op, OpKind::Start);
1740 "Unable to add the next operation request to the curl multi-handle");
1741 OpRecord(*op, OpKind::Error);
1743 queue.RecycleHandle(iter->first);
1754 int wait_socket = -1;
1756 m_logger->Error(
kLogXrdClHttp,
"Failed to start broker-based connection: %s", err.c_str());
1758 keep_handle =
false;
1760 curl_multi_remove_handle(multi_handle, iter->first);
1761 auto expiry = time(
nullptr) + 20;
1762 m_logger->Debug(
kLogXrdClHttp,
"Curl operation requires a new TCP socket; waiting for callout to respond on socket %d", wait_socket);
1763 broker_reqs[wait_socket] = {iter->first, expiry};
1764 m_conncall_req.fetch_add(1, std::memory_order_relaxed);
1767 if (res == CURLE_ABORTED_BY_CALLBACK || res == CURLE_WRITE_ERROR) {
1772#ifdef HAVE_XPROTOCOL_TIMEREXPIRED
1777 OpRecord(*op, OpKind::Error);
1782 OpRecord(*op, OpKind::Error);
1787 OpRecord(*op, op->
IsPaused() ? OpKind::ClientTimeout : OpKind::ServerTimeout);
1791 OpRecord(*op, OpKind::ServerTimeout);
1795 OpRecord(*op, OpKind::ClientTimeout);
1799 OpRecord(*op, OpKind::ServerTimeout);
1803 OpRecord(*op, OpKind::Error);
1807 if ((options_op =
dynamic_cast<CurlOptionsOp*
>(op.get())) !=
nullptr) {
1809 bool parent_op_failed =
false;
1810 if (parent_op->IsRedirect()) {
1814 if (iter != m_op_map.end()) {
1815 OpRecord(*iter->second.first, OpKind::Error);
1817 m_op_map.erase(iter);
1818 running_handles -= 1;
1820 parent_op_failed =
true;
1822 OpRecord(*parent_op, OpKind::Start);
1825 OpRecord(*parent_op, OpKind::Start);
1827 if (!parent_op_failed){
1834 const char *curl_easy_err = curl_easy_strerror(res);
1835 const std::string fail_err = !curl_err.empty() ? curl_err : curl_easy_err;
1836 m_logger->Debug(
kLogXrdClHttp,
"Curl generated an error: %s (%d)", fail_err.c_str(), res);
1837 op->
Fail(xrdCode.first, xrdCode.second, fail_err);
1838 OpRecord(*op, OpKind::Error);
1840 if ((options_op =
dynamic_cast<CurlOptionsOp*
>(op.get())) !=
nullptr) {
1842 bool parent_op_failed =
false;
1843 if (parent_op->IsRedirect()) {
1847 if (iter != m_op_map.end()) {
1848 OpRecord(*iter->second.first, OpKind::Error);
1850 m_op_map.erase(iter);
1851 running_handles -= 1;
1853 parent_op_failed =
true;
1856 if (!parent_op_failed){
1864 curl_multi_remove_handle(multi_handle, iter->first);
1865 if (res != CURLE_OK) {
1866 curl_easy_cleanup(iter->first);
1868 for (
auto &req : broker_reqs) {
1869 if (req.second.curl == iter->first) {
1870 m_logger->Warning(
kLogXrdClHttp,
"Curl handle finished while a broker operation was outstanding");
1871 m_conncall_errors.fetch_add(1, std::memory_order_relaxed);
1874 m_op_map.erase(iter);
1875 running_handles -= 1;
1881 for (
auto map_entry : m_op_map) {
1884 OpRecord(*map_entry.second.first, OpKind::Error);
1886 if (multi_handle && map_entry.first) curl_multi_remove_handle(multi_handle, map_entry.first);
1889 m_queue->ReleaseHandles();
1890 curl_multi_cleanup(multi_handle);