use tlsOut BIO when using websocket in rdg_bio_ctrl

(cherry picked from commit 0e19c443e4)
This commit is contained in:
akarl 2021-03-05 18:19:06 +01:00 committed by akallabeth
parent 2f46d06fdf
commit c138785669

View File

@ -1537,7 +1537,7 @@ DWORD rdg_get_event_handles(rdpRdg* rdg, HANDLE* events, DWORD count)
return 0;
}
if (rdg->tlsIn && rdg->tlsIn->bio)
if (!rdg->transferEncoding.isWebsocketTransport && rdg->tlsIn && rdg->tlsIn->bio)
{
if (events && (nCount < count))
{
@ -2403,7 +2403,8 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
if (cmd == BIO_CTRL_FLUSH)
{
(void)BIO_flush(tlsOut->bio);
(void)BIO_flush(tlsIn->bio);
if (!rdg->transferEncoding.isWebsocketTransport)
(void)BIO_flush(tlsIn->bio);
status = 1;
}
else if (cmd == BIO_C_SET_NONBLOCK)
@ -2418,6 +2419,10 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
else if (cmd == BIO_C_WRITE_BLOCKED)
{
BIO* bio = tlsIn->bio;
if (rdg->transferEncoding.isWebsocketTransport)
bio = tlsOut->bio;
status = BIO_write_blocked(bio);
}
else if (cmd == BIO_C_WAIT_READ)
@ -2437,6 +2442,9 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
int timeout = (int)arg1;
BIO* bio = tlsIn->bio;
if (rdg->transferEncoding.isWebsocketTransport)
bio = tlsOut->bio;
if (BIO_write_blocked(bio))
status = BIO_wait_write(bio, timeout);
else if (BIO_read_blocked(bio))