[rabbitmq-discuss] Frame generation

Ben Hood 0x6e6562 at gmail.com
Mon Jul 30 15:39:41 BST 2007


Hi,

I don't know whether this is a bug or not, but I think the encoding
for the start.connection_ok method may be wrong. The response field is
actually a table but is not being encoded as such. I've included a
patch for inspection. To provoke this problem, the use the following:

f() ->
    rabbit_binary_generator:build_simple_method_frame(1, start_ok() ),

start_ok() ->
    #'connection.start_ok'{
		client_properties = [
                            {<<"product">>,longstr,<<"Erlang-AMQC">>},
                            {<<"version">>,longstr,<<"0.1">>},
                            {<<"platform">>,longstr,<<"Erlang">>}
							],
        mechanism = <<"AMQPLAIN">>,
        response = [
                    {<<"LOGIN">>, longstr, <<"a">> },
                    {<<"PASSWORD">>, longstr, <<"a">> }
                    ],
        locale = <<"en_US">>
	}.

BTW, is there a bug database for rabbit rather than posting to the list?

HTH,

Ben

-------

diff -r fb6ff292558d src/rabbit_framing.erl
--- a/src/rabbit_framing.erl    Sun Jul 29 14:09:25 2007 +0100
+++ b/src/rabbit_framing.erl    Mon Jul 30 15:34:06 2007 +0100
@@ -1355,9 +1355,10 @@ encode_method_fields(#'connection.start_
   F0Tab = rabbit_binary_generator:generate_table(F0),
   F0Len = size(F0Tab),
   F1Len = size(F1),
-  F2Len = size(F2),
+  F2Tab = rabbit_binary_generator:generate_table(F2),
+  F2Len = size(F2Tab),
   F3Len = size(F3),
-  <<F0Len:32/unsigned, F0Tab:F0Len/binary, F1Len:8/unsigned,
F1:F1Len/binary, F2Len:32/unsigned, F2:F2Len/binary, F3Len:8/unsigned,
F3:F3Len/binary>>;
+  <<F0Len:32/unsigned, F0Tab:F0Len/binary, F1Len:8/unsigned,
F1:F1Len/binary, F2Len:32/unsigned, F2Tab:F2Len/binary,
F3Len:8/unsigned, F3:F3Len/binary>>;
 encode_method_fields(#'connection.secure'{challenge = F0}) ->
   F0Len = size(F0),
   <<F0Len:32/unsigned, F0:F0Len/binary>>;




More information about the rabbitmq-discuss mailing list