aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-02-18 11:11:24 +0100
committerAnders Svensson <[email protected]>2015-03-04 08:59:04 +0100
commitc74b593a185bde920497ef6d25c92c896949d07c (patch)
treeb7a7172136959cfdc59844896db02a54cbd6cdf8 /lib
parent545d06c58377938877f1a29a4a078c12644be676 (diff)
downloadotp-c74b593a185bde920497ef6d25c92c896949d07c.tar.gz
otp-c74b593a185bde920497ef6d25c92c896949d07c.tar.bz2
otp-c74b593a185bde920497ef6d25c92c896949d07c.zip
Allow encode of decoded diameter_avp list
The decode of an incoming request in a non-relay application results in a deep list of diameter_avp records. Encoding such a list resulted in a function_clause error in diameter_codec:pack_avp/1, which expected a flat list. The list is only flat in the relay case, or in the absence of AVPs of type Grouped. This is also related to code that exists but isn't documented. It's documented that a diameter_app(3) handle_request callback can return {relay, Opts} to relay a request received in the relay application. What's not documented is that it can also return {proxy|resend, Opts} in a non-relay application, but this leads to encode failure when there are Grouped AVPs. This shouldn't be interpreted as meaning that proxy|resend are now supported: they aren't. The two extra terms are a historical relic that should probably be removed. Neither are generally usable since, for example, a proxy agent may want to modify a request before resending it. A specific handle_request return is not needed to implement a proxy agent. Even {relay, Opts} isn't strictly necessary.
Diffstat (limited to 'lib')
-rw-r--r--lib/diameter/src/base/diameter_codec.erl2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/diameter/src/base/diameter_codec.erl b/lib/diameter/src/base/diameter_codec.erl
index dd9039d7dc..9bc8178230 100644
--- a/lib/diameter/src/base/diameter_codec.erl
+++ b/lib/diameter/src/base/diameter_codec.erl
@@ -582,6 +582,8 @@ split_data(Bin, Len) ->
%% dictionary doesn't know about specific AVP's.
%% Grouped AVP whose components need packing ...
+pack_avp([#diameter_avp{} = A | Avps]) ->
+ pack_avp(A#diameter_avp{data = Avps});
pack_avp(#diameter_avp{data = [#diameter_avp{} | _] = Avps} = A) ->
pack_avp(A#diameter_avp{data = encode_avps(Avps)});