From 4f6545f4acda8fccbb66776c8798a8d458a7440a Mon Sep 17 00:00:00 2001 From: Slaven Rezic Date: Fri, 16 Jan 2015 17:07:47 +0100 Subject: [PATCH] support for receiving boolean amqp header values This should fix RT #101574. --- RabbitMQ.pm | 2 +- RabbitMQ.xs | 10 ++++++++++ amqp.h | 1 + amqp_table.c | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/RabbitMQ.pm b/RabbitMQ.pm index 0cae00b..a68bcf5 100644 --- a/RabbitMQ.pm +++ b/RabbitMQ.pm @@ -4,7 +4,7 @@ require DynaLoader; use strict; use vars qw($VERSION @ISA); -$VERSION = "0.2.7"; +$VERSION = "0.2.7_01"; @ISA = qw/DynaLoader/; bootstrap Net::RabbitMQ $VERSION ; diff --git a/RabbitMQ.xs b/RabbitMQ.xs index 97e4e12..0d1dfb2 100644 --- a/RabbitMQ.xs +++ b/RabbitMQ.xs @@ -201,6 +201,16 @@ int internal_recv(HV *RETVAL, amqp_connection_state_t conn, int piggyback) { 0 ); } + else if( p->headers.entries[i].kind == 't' ) { + hv_store( headers, + p->headers.entries[i].key.bytes, p->headers.entries[i].key.len, + newSViv(p->headers.entries[i].value.boolean), + 0 + ); + } + else { + Perl_croak(aTHX_ "Unhandled AMQP type '%c'", p->headers.entries[i].kind == 't'); + } } } diff --git a/amqp.h b/amqp.h index ec059ce..0a1dad6 100644 --- a/amqp.h +++ b/amqp.h @@ -43,6 +43,7 @@ typedef struct amqp_table_entry_t_ { amqp_decimal_t decimal; uint64_t u64; amqp_table_t table; + amqp_boolean_t boolean; /**< boolean type AMQP_FIELD_KIND_BOOLEAN */ } value; } amqp_table_entry_t; diff --git a/amqp_table.c b/amqp_table.c index bfbd17a..c6ef59b 100644 --- a/amqp_table.c +++ b/amqp_table.c @@ -80,6 +80,10 @@ int amqp_decode_table(amqp_bytes_t encoded, case 'F': AMQP_CHECK_RESULT(amqp_decode_table(encoded, pool, &(entry->value.table), &offset)); break; + case 't': + entry->value.boolean = D_8(encoded, offset); + offset += 1; + break; default: return -EINVAL; } -- 2.1.2