From 3a3da82aa98513de45fbc1abd081ea93d420c7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristo=CC=81fer=20R?= Date: Thu, 31 Oct 2024 18:09:36 -0400 Subject: [PATCH] Update explanation for number of digits in port number The explanation now refers to RFC 793 instead of just claiming some arbitrary value as truth. The previous value was correct, but now there is a proper source for the correct value. --- src/termio/stream_handler.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/termio/stream_handler.zig b/src/termio/stream_handler.zig index 00762bc73..bd2017f89 100644 --- a/src/termio/stream_handler.zig +++ b/src/termio/stream_handler.zig @@ -1071,7 +1071,9 @@ pub const StreamHandler = struct { // The URI will be parsed as if the last set o digit is a port, so we need to // make sure that part is included when it's set. if (uri.port) |port| { - // 65_535 is considered the highest port number on Linux. + // RFC 793 defines port numbers as 16-bit numbers. 5 digits is sufficient to represent + // the maximum since 2^16 - 1 = 65_535. + // See https://www.rfc-editor.org/rfc/rfc793#section-3.1. const PORT_NUMBER_MAX_DIGITS = 5; // Make sure there is space for a max length hostname + the max number of digits.