minimalistic-server 0.0.27 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +8 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1222,6 +1222,14 @@ export class Request {
|
|
|
1222
1222
|
return;
|
|
1223
1223
|
}
|
|
1224
1224
|
|
|
1225
|
+
const webSocketHeader = this.#headers["sec-websocket-key"];
|
|
1226
|
+
|
|
1227
|
+
if (!webSocketHeader) {
|
|
1228
|
+
throw new JsonResponse({
|
|
1229
|
+
message: 'Header "sec-websocket-key" is missing',
|
|
1230
|
+
}, 400);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1225
1233
|
const socket = this.#request.socket;
|
|
1226
1234
|
|
|
1227
1235
|
this.#webSocketData = {
|
|
@@ -1237,7 +1245,6 @@ export class Request {
|
|
|
1237
1245
|
};
|
|
1238
1246
|
|
|
1239
1247
|
const guid = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
1240
|
-
const webSocketHeader = this.#headers["sec-websocket-key"];
|
|
1241
1248
|
const sha1 = nodeCrypto.createHash("sha1");
|
|
1242
1249
|
sha1.update(webSocketHeader + guid);
|
|
1243
1250
|
const validHandShakeKey = sha1.digest("base64");
|