@@ -63,12 +63,14 @@ validate_binding(_X, #binding{args = Args}) ->
6363 {binding_invalid ,
6464 " Invalid x-match field type ~p (value ~p ); "
6565 " expected longstr" , [Type , Other ]}};
66- undefined -> {error ,
67- {binding_invalid , " x-match field missing" , []}}
66+ undefined -> ok % % [0]
6867 end .
68+ % % [0] spec is vague on whether it can be omitted but in practice it's
69+ % % useful to allow people to do this
6970
70- parse_x_match (<<" all" >>) -> all ;
71- parse_x_match (<<" any" >>) -> any .
71+ parse_x_match ({longstr , <<" all" >>}) -> all ;
72+ parse_x_match ({longstr , <<" any" >>}) -> any ;
73+ parse_x_match (_ ) -> all . % % legacy; we didn't validate
7274
7375% % Horrendous matching algorithm. Depends for its merge-like
7476% % (linear-time) behaviour on the lists:keysort
@@ -80,8 +82,8 @@ parse_x_match(<<"any">>) -> any.
8082% % !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
8183% %
8284headers_match (Args , Data ) ->
83- { longstr , MK } = rabbit_misc :table_lookup (Args , <<" x-match" >>),
84- headers_match (Args , Data , true , false , parse_x_match ( MK ) ).
85+ MK = parse_x_match ( rabbit_misc :table_lookup (Args , <<" x-match" >>) ),
86+ headers_match (Args , Data , true , false , MK ).
8587
8688headers_match ([], _Data , AllMatch , _AnyMatch , all ) ->
8789 AllMatch ;
0 commit comments