summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2013-08-28 12:53:09 +0100
committerEmile Joubert <emile@rabbitmq.com>2013-08-28 12:53:09 +0100
commit4693167d61f11b5feba40da5cc6a2d6967bde0c0 (patch)
tree22a14ac6358b2e5ea7bde0f4dc8d088758116096
parent43c6a027c1874200d3af529fc132e3411b24f622 (diff)
downloadrabbitmq-server-bug25733.tar.gz
Relax headers type constraintsbug25733
-rw-r--r--src/rabbit_exchange_type_headers.erl12
-rw-r--r--src/rabbit_misc.erl4
2 files changed, 8 insertions, 8 deletions
diff --git a/src/rabbit_exchange_type_headers.erl b/src/rabbit_exchange_type_headers.erl
index baec9c29..c841560e 100644
--- a/src/rabbit_exchange_type_headers.erl
+++ b/src/rabbit_exchange_type_headers.erl
@@ -103,17 +103,15 @@ headers_match([{PK, _PT, _PV} | PRest], Data = [{DK, _DT, _DV} | _],
headers_match([{PK, PT, PV} | PRest], [{DK, DT, DV} | DRest],
AllMatch, AnyMatch, MatchKind) when PK == DK ->
{AllMatch1, AnyMatch1} =
- if
+ case rabbit_misc:type_class(PT) == rabbit_misc:type_class(DT) of
%% It's not properly specified, but a "no value" in a
%% pattern field is supposed to mean simple presence of
%% the corresponding data field. I've interpreted that to
%% mean a type of "void" for the pattern field.
- PT == void -> {AllMatch, true};
- %% Similarly, it's not specified, but I assume that a
- %% mismatched type causes a mismatched value.
- PT =/= DT -> {false, AnyMatch};
- PV == DV -> {AllMatch, true};
- true -> {false, AnyMatch}
+ _ when PT == void -> {AllMatch, true};
+ false -> {false, AnyMatch};
+ _ when PV == DV -> {AllMatch, true};
+ _ -> {false, AnyMatch}
end,
headers_match(PRest, DRest, AllMatch1, AnyMatch1, MatchKind).
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index bca9d5ce..8cc83265 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -21,7 +21,8 @@
-export([method_record_type/1, polite_pause/0, polite_pause/1]).
-export([die/1, frame_error/2, amqp_error/4, quit/1,
protocol_error/3, protocol_error/4, protocol_error/1]).
--export([not_found/1, absent/1, assert_args_equivalence/4]).
+-export([not_found/1, absent/1]).
+-export([type_class/1, assert_args_equivalence/4]).
-export([dirty_read/1]).
-export([table_lookup/2, set_table_value/4]).
-export([r/3, r/2, r_arg/4, rs/1]).
@@ -120,6 +121,7 @@
(rabbit_types:amqp_error()) -> channel_or_connection_exit()).
-spec(not_found/1 :: (rabbit_types:r(atom())) -> rabbit_types:channel_exit()).
-spec(absent/1 :: (rabbit_types:amqqueue()) -> rabbit_types:channel_exit()).
+-spec(type_class/1 :: (rabbit_framing:amqp_field_type()) -> atom()).
-spec(assert_args_equivalence/4 :: (rabbit_framing:amqp_table(),
rabbit_framing:amqp_table(),
rabbit_types:r(any()), [binary()]) ->