Refuse a maxOctets below 1 at startup, like the other limits #24

Merged
lilleman merged 2 commits from range-check-max-octets into main 2026-09-24 00:08:19 +02:00
2 changed files with 4 additions and 2 deletions
Showing only changes of commit c5ef4c4703 - Show all commits
+2 -2
View File
@@ -35,8 +35,8 @@
- An `alert_notification` or an `outbind` from the peer is logged and left unanswered, as SMPP 3.4
gives neither a response. Each one used to emit `sessionError`, `"alert_notification" has no
response command`.
- `server()` refuses a `maxOctets` below 1 or not a whole number, like its other limits.
`server({ maxOctets: 0 })` used to start and then drop every multipart message.
- `server()` refuses a `maxOctets` below 1 or not a whole number, `Infinity` included, like its
other limits. `server({ maxOctets: 0 })` used to start and then refuse every multipart message.
## 0.5.0
+2
View File
@@ -12,6 +12,7 @@ import { DlrMerger } from '../src/dlr-merger.ts';
import { PduFramer } from '../src/pdu-framer.ts';
import { ReconnectLoop } from '../src/reconnect-loop.ts';
import { Session, bindCommands } from '../src/session.ts';
import { checkSessionOptions } from '../src/session-options.ts';
import { client } from '../src/client.ts';
import { closeAfter, closeListenerAfter } from './teardown.ts';
import { consts } from '../src/defs/constants.ts';
@@ -2694,6 +2695,7 @@ describe('option validation', () => {
if (listening.server) await listening.server.close();
assert.match(listening.err?.message ?? '', /maxOctets must be 1 or more, got 0/);
assert.match(checkSessionOptions({ maxOctets: Infinity }).err?.message ?? '', /maxOctets must be 1 or more, got Infinity/);
});
test('returns an error rather than rejecting on an impossible port', async () => {