mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 11:06:10 +00:00
LibTLS: Make TLSv12::can_read_without_blocking() actually work
Previously this function's return value was not reliable, as available data on the underlying socket did not necessarily translate to available application data on the TLS socket. This commit makes it so this function only returns true when we actually have data buffered and/or available.
This commit is contained in:
parent
3feed4b56f
commit
516d68f7eb
1 changed files with 7 additions and 1 deletions
|
@ -134,7 +134,13 @@ ErrorOr<bool> TLSv12::can_read_without_blocking(int timeout) const
|
||||||
if (!m_ssl)
|
if (!m_ssl)
|
||||||
return Error::from_string_literal("SSL connection is closed");
|
return Error::from_string_literal("SSL connection is closed");
|
||||||
|
|
||||||
return m_socket->can_read_without_blocking(timeout);
|
if (SSL_has_pending(m_ssl))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (timeout > 0)
|
||||||
|
return TRY(m_socket->can_read_without_blocking(timeout)) && SSL_has_pending(m_ssl);
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<void> TLSv12::set_blocking(bool)
|
ErrorOr<void> TLSv12::set_blocking(bool)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue