Make permessage-deflate status queryable in websocket::stream

This commit is contained in:
Saleh Hatefinya authored and Mohammad Nejati committed 2024-09-01 17:51:11 +03:30
1 parent a9121c259b
commit 21545dbcaf
4 files changed
+116

No files matched your search

+55
View File
@@ -136,6 +136,61 @@ public:
}
ts.close();
});
// handshake, deflate, supported
doStreamLoop([&](test::stream &ts)
{
echo_server es{log};
ws_type ws{ts};
ws.next_layer().connect(es.stream());
response_type res;
try
{
websocket::permessage_deflate option{};
option.client_enable = true;
option.client_max_window_bits = 14;
ws.set_option(option);
w.handshake(ws, res, "localhost", "/");
websocket::permessage_deflate_status status;
ws.get_status(status);
BEAST_EXPECT(status.active);
BEAST_EXPECT(9 == status.server_window_bits);
BEAST_EXPECT(14 == status.client_window_bits);
}
catch(...)
{
ts.close();
throw;
}
ts.close();
});
// handshake, deflate, not supported
doStreamLoop([&](test::stream &ts)
{
echo_server es{log};
ws_type_t<false> ws{ts};
ws.next_layer().connect(es.stream());
response_type res;
try
{
w.handshake(ws, res, "localhost", "/");
websocket::permessage_deflate_status status;
ws.get_status(status);
BEAST_EXPECT(!status.active);
BEAST_EXPECT(0 == status.server_window_bits);
BEAST_EXPECT(0 == status.client_window_bits);
}
catch(...)
{
ts.close();
throw;
}
ts.close();
});
}
void