forked from uNetworking/uWebSockets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Extensions.cpp
39 lines (27 loc) · 1.09 KB
/
Extensions.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* This is a fuzz test of the websocket extensions parser */
#define WIN32_EXPORT
#include <cstdio>
#include <string>
/* We test the websocket extensions parser */
#include "../src/WebSocketExtensions.h"
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
{
uWS::ExtensionsNegotiator<true> extensionsNegotiator(uWS::Options::PERMESSAGE_DEFLATE);
extensionsNegotiator.readOffer({(char *) data, size});
extensionsNegotiator.generateOffer();
extensionsNegotiator.getNegotiatedOptions();
}
{
uWS::ExtensionsNegotiator<true> extensionsNegotiator(uWS::Options::NO_OPTIONS);
extensionsNegotiator.readOffer({(char *) data, size});
extensionsNegotiator.generateOffer();
extensionsNegotiator.getNegotiatedOptions();
}
{
uWS::ExtensionsNegotiator<true> extensionsNegotiator(uWS::Options::CLIENT_NO_CONTEXT_TAKEOVER);
extensionsNegotiator.readOffer({(char *) data, size});
extensionsNegotiator.generateOffer();
extensionsNegotiator.getNegotiatedOptions();
}
return 0;
}