Skip to content

Commit 8e9b3cb

Browse files
committed
fix: fixed order of ip validation for QUICSocket.send
1 parent f37cc29 commit 8e9b3cb

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

src/QUICSocket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,14 +390,14 @@ class QUICSocket {
390390
}
391391
const host = params[index] as Host | Hostname;
392392
let [host_, udpType] = await utils.resolveHost(host, this.resolveHostname);
393+
host_ = utils.resolvesZeroIP(host_);
393394
host_ = utils.validateTarget(
394395
this._host,
395396
this._type,
396397
host_,
397398
udpType,
398399
errors.ErrorQUICSocketInvalidSendAddress,
399400
);
400-
host_ = utils.resolvesZeroIP(host_);
401401
params[index] = host_;
402402
return this.socketSend(...params);
403403
}

tests/QUICSocket.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,6 @@ describe(QUICSocket.name, () => {
238238
'name',
239239
'RangeError',
240240
);
241-
await expect(socket.send(msg, ipv4SocketPort, '0.0.0.0')).rejects.toThrow(
242-
errors.ErrorQUICSocketInvalidSendAddress,
243-
);
244241
expect(handleEventQUICSocketError).not.toHaveBeenCalled();
245242
await socket.stop();
246243
expect(handleEventQUICSocketError).not.toHaveBeenCalled();

0 commit comments

Comments
 (0)