1
0
mirror of https://github.com/xmrig/xmrig.git synced 2025-12-06 15:42:38 -05:00

Fixed HttpsClient::flush logic

- Don't write empty buffers
- Don't write if an error was returned
This commit is contained in:
SChernykh
2025-04-17 10:32:14 +02:00
committed by GitHub
parent 6cfc02d24f
commit d24e13e605

View File

@@ -189,10 +189,12 @@ void xmrig::HttpsClient::flush(bool close)
}
char *data = nullptr;
const size_t size = BIO_get_mem_data(m_write, &data); // NOLINT(cppcoreguidelines-pro-type-cstyle-cast)
std::string body(data, size);
const long size = BIO_get_mem_data(m_write, &data); // NOLINT(cppcoreguidelines-pro-type-cstyle-cast)
std::string body(data, (size > 0) ? size : 0);
(void) BIO_reset(m_write);
HttpContext::write(std::move(body), close);
if (!body.empty()) {
HttpContext::write(std::move(body), close);
}
}