Trigger more context functions when fuzzing

This commit is contained in:
Alex Hultman
2020-08-20 19:45:11 +02:00
parent 2544593c13
commit 426d4aa298
+47 -38
View File
@@ -13,45 +13,54 @@ void test() {
/* Fill with user data */ /* Fill with user data */
}; };
/* Keep in mind that uWS::SSLApp({options}) is the same as uWS::App() when compiled without SSL support. {
* You may swap to using uWS:App() if you don't need SSL */ /* Keep in mind that uWS::SSLApp({options}) is the same as uWS::App() when compiled without SSL support.
uWS::App({ * You may swap to using uWS:App() if you don't need SSL */
/* There are example certificates in uWebSockets.js repo */ auto app = uWS::App({
.key_file_name = "../misc/key.pem", /* There are example certificates in uWebSockets.js repo */
.cert_file_name = "../misc/cert.pem", .key_file_name = "../misc/key.pem",
.passphrase = "1234" .cert_file_name = "../misc/cert.pem",
}).ws<PerSocketData>("/*", { .passphrase = "1234"
/* Settings */ }).ws<PerSocketData>("/*", {
.compression = uWS::SHARED_COMPRESSOR, /* Settings */
.maxPayloadLength = 16 * 1024, .compression = uWS::SHARED_COMPRESSOR,
.idleTimeout = 10, .maxPayloadLength = 16 * 1024,
.maxBackpressure = 1 * 1024 * 1024, .idleTimeout = 10,
/* Handlers */ .maxBackpressure = 1 * 1024 * 1024,
.open = [](auto *ws) { /* Handlers */
/* Open event here, you may access ws->getUserData() which points to a PerSocketData struct */ .open = [](auto *ws) {
ws->getNativeHandle(); /* Open event here, you may access ws->getUserData() which points to a PerSocketData struct */
ws->getRemoteAddressAsText(); ws->getNativeHandle();
}, ws->getRemoteAddressAsText();
.message = [](auto *ws, std::string_view message, uWS::OpCode opCode) { },
ws->send(message, opCode, true); .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
}, ws->send(message, opCode, true);
.drain = [](auto *ws) { },
/* Check ws->getBufferedAmount() here */ .drain = [](auto *ws) {
}, /* Check ws->getBufferedAmount() here */
.ping = [](auto *ws) { },
/* Not implemented yet */ .ping = [](auto *ws) {
}, /* Not implemented yet */
.pong = [](auto *ws) { },
/* Not implemented yet */ .pong = [](auto *ws) {
}, /* Not implemented yet */
.close = [](auto *ws, int code, std::string_view message) { },
/* You may access ws->getUserData() here */ .close = [](auto *ws, int code, std::string_view message) {
} /* You may access ws->getUserData() here */
}).listen(9001, [](auto *listenSocket) { }
listen_socket = listenSocket; }).listen(9001, [](auto *listenSocket) {
}).run(); listen_socket = listenSocket;
});
uWS::Loop::get()->free(); /* Trigger some context functions */
app.addServerName("", {});
app.removeServerName("");
app.missingServerName(nullptr);
app.getNativeHandle();
app.run();
}
uWS::Loop::get()->free();
} }
/* Thus function should shutdown the event-loop and let the test fall through */ /* Thus function should shutdown the event-loop and let the test fall through */