mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2026-04-28 09:12:08 -06:00
node_modules: update (#138)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
+1
@@ -27,6 +27,7 @@ import { errors } from 'undici'
|
||||
| `InformationalError` | `UND_ERR_INFO` | expected error with reason |
|
||||
| `ResponseExceededMaxSizeError` | `UND_ERR_RES_EXCEEDED_MAX_SIZE` | response body exceed the max size allowed |
|
||||
| `SecureProxyConnectionError` | `UND_ERR_PRX_TLS` | tls connection to a proxy failed |
|
||||
| `MessageSizeExceededError` | `UND_ERR_WS_MESSAGE_SIZE_EXCEEDED` | WebSocket decompressed message exceeded the maximum allowed size |
|
||||
|
||||
### `SocketError`
|
||||
|
||||
|
||||
+23
@@ -13,6 +13,15 @@ Arguments:
|
||||
* **url** `URL | string` - The url's protocol *must* be `ws` or `wss`.
|
||||
* **protocol** `string | string[] | WebSocketInit` (optional) - Subprotocol(s) to request the server use, or a [`Dispatcher`](./Dispatcher.md).
|
||||
|
||||
### WebSocketInit
|
||||
|
||||
When passing an object as the second argument, the following options are available:
|
||||
|
||||
* **protocols** `string | string[]` (optional) - Subprotocol(s) to request the server use.
|
||||
* **dispatcher** `Dispatcher` (optional) - A custom [`Dispatcher`](/docs/docs/api/Dispatcher.md) to use for the connection.
|
||||
* **headers** `HeadersInit` (optional) - Custom headers to include in the WebSocket handshake request.
|
||||
* **maxDecompressedMessageSize** `number` (optional) - Maximum allowed size in bytes for decompressed messages when using the `permessage-deflate` extension. **Default:** `4194304` (4 MB).
|
||||
|
||||
### Example:
|
||||
|
||||
This example will not work in browsers or other platforms that don't allow passing an object.
|
||||
@@ -36,6 +45,20 @@ import { WebSocket } from 'undici'
|
||||
const ws = new WebSocket('wss://echo.websocket.events', ['echo', 'chat'])
|
||||
```
|
||||
|
||||
### Example with custom decompression limit:
|
||||
|
||||
To protect against decompression bombs (small compressed payloads that expand to very large sizes), you can set a custom limit:
|
||||
|
||||
```mjs
|
||||
import { WebSocket } from 'undici'
|
||||
|
||||
const ws = new WebSocket('wss://echo.websocket.events', {
|
||||
maxDecompressedMessageSize: 1 * 1024 * 1024
|
||||
})
|
||||
```
|
||||
|
||||
> ⚠️ **Security Note**: The `maxDecompressedMessageSize` option protects against memory exhaustion attacks where a malicious server sends a small compressed payload that decompresses to an extremely large size. If you increase this limit significantly above the default, ensure your application can handle the increased memory usage.
|
||||
|
||||
## Read More
|
||||
|
||||
- [MDN - WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
|
||||
Reference in New Issue
Block a user