use char_of_int

This commit is contained in:
Mylloon 2023-06-14 16:35:03 +02:00
parent 2fa8f1083b
commit 278c9e5e17
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -25,9 +25,8 @@ let encode_dns_name domain_name =
let encoded_parts = let encoded_parts =
List.map List.map
(fun part -> (fun part ->
let len_part = String.length part in let len_part = char_of_int (String.length part) in
let len_byte = Char.chr len_part in Bytes.cat (Bytes.of_string (String.make 1 len_part)) (Bytes.of_string part))
Bytes.cat (Bytes.of_string (String.make 1 len_byte)) (Bytes.of_string part))
parts parts
in in
Bytes.cat (Bytes.concat Bytes.empty encoded_parts) (Bytes.of_string "\x00") Bytes.cat (Bytes.concat Bytes.empty encoded_parts) (Bytes.of_string "\x00")