http: check for cb in async_read_until

This commit is contained in:
Adrien Beraud committed 2025-05-22 11:53:05 -04:00
1 parent 3e407e65fa
commit 405220795b
1 file changed
+1 -1
+1 -1
View File
@@ -604,7 +604,7 @@ Connection::async_read_until(const char* delim, BytesHandlerCb cb)
{
std::lock_guard<std::mutex> lock(mutex_);
if (!is_open()) {
asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
if (cb) asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
return;
}
if (ssl_socket_) asio::async_read_until(*ssl_socket_, read_buf_, delim, wrapCallback(std::move(cb)));