use tlsOut BIO when using websocket in rdg_bio_ctrl
@@ -1538,7 +1538,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))
{
@@ -2404,6 +2404,7 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
if (cmd == BIO_CTRL_FLUSH)
{
(void)BIO_flush(tlsOut->bio);
+ if (!rdg->transferEncoding.isWebsocketTransport)
(void)BIO_flush(tlsIn->bio);
status = 1;
}
@@ -2419,6 +2420,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)
@@ -2438,6 +2443,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))
