diff options
| author | Emile Joubert <emile@rabbitmq.com> | 2013-05-09 17:23:33 +0100 |
|---|---|---|
| committer | Emile Joubert <emile@rabbitmq.com> | 2013-05-09 17:23:33 +0100 |
| commit | 6d3fe1ccdf4df529f4b80d29bdd9be184bcb90ca (patch) | |
| tree | 9089bb6a8f045133c765beba31ecd52a2923461b /src | |
| parent | 81e8c1903e0e33df4cbe6ddb757331150233d00c (diff) | |
| parent | 48cf514c121fd0adfc536709712a0bf2c4e44b09 (diff) | |
| download | rabbitmq-server-git-6d3fe1ccdf4df529f4b80d29bdd9be184bcb90ca.tar.gz | |
Merged stable into default
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_exchange_type_headers.erl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/rabbit_exchange_type_headers.erl b/src/rabbit_exchange_type_headers.erl index cf2d314079..5b7f95feeb 100644 --- a/src/rabbit_exchange_type_headers.erl +++ b/src/rabbit_exchange_type_headers.erl @@ -63,12 +63,14 @@ validate_binding(_X, #binding{args = Args}) -> {binding_invalid, "Invalid x-match field type ~p (value ~p); " "expected longstr", [Type, Other]}}; - undefined -> {error, - {binding_invalid, "x-match field missing", []}} + undefined -> ok %% [0] end. +%% [0] spec is vague on whether it can be omitted but in practice it's +%% useful to allow people to do this -parse_x_match(<<"all">>) -> all; -parse_x_match(<<"any">>) -> any. +parse_x_match({longstr, <<"all">>}) -> all; +parse_x_match({longstr, <<"any">>}) -> any; +parse_x_match(_) -> all. %% legacy; we didn't validate %% Horrendous matching algorithm. Depends for its merge-like %% (linear-time) behaviour on the lists:keysort @@ -80,8 +82,8 @@ parse_x_match(<<"any">>) -> any. %% !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %% headers_match(Args, Data) -> - {longstr, MK} = rabbit_misc:table_lookup(Args, <<"x-match">>), - headers_match(Args, Data, true, false, parse_x_match(MK)). + MK = parse_x_match(rabbit_misc:table_lookup(Args, <<"x-match">>)), + headers_match(Args, Data, true, false, MK). headers_match([], _Data, AllMatch, _AnyMatch, all) -> AllMatch; |
