summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xua_codec.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/xua_codec.erl b/src/xua_codec.erl
index 7fb3103..ad5cbd3 100644
--- a/src/xua_codec.erl
+++ b/src/xua_codec.erl
@@ -89,10 +89,14 @@ encode_xua_opts([{Iei, Attr}|Tail], Bin) ->
OptBin = encode_xua_opt(Iei, Attr),
encode_xua_opts(Tail, <<Bin/binary, OptBin/binary>>).
+% convert integer parameters to binary before continuing
+encode_xua_opt(Iei, {LenIn, Data}) when is_integer(Iei), is_integer(Data) ->
+ encode_xua_opt(Iei, {LenIn, <<Data:LenIn/big-integer-unit:8>>});
+
encode_xua_opt(Iei, {LenIn, Data}) when is_integer(Iei), is_binary(Data) ->
Length = LenIn + 4,
PadLen = get_num_pad_bytes(Length),
- <<Iei:16/big, Length:16/big, Data/binary, 0:PadLen/integer-unit:8>>;
+ <<Iei:16/big, Length:16/big, Data:LenIn/binary, 0:PadLen/integer-unit:8>>;
encode_xua_opt(Iei, Data) when is_integer(Iei), is_binary(Data) ->
Length = byte_size(Data) + 4,
PadLen = get_num_pad_bytes(Length),