[reSIProcate] bug in TransportSelector - popping Route
Derek and I have been going back and forth on this bug in the
TransportSelector. After carefully reading the rfc. I have come to the
conclusion that the current behavior is incorrect and needs to be changed.
TransportSelector.cxx:316
else if (msg->exists(h_Routes) && !msg->header(h_Routes).empty())
{
// put this into the target, in case the send later fails, so we
don't
// lose the target
msg->setForceTarget(msg->header(h_Routes).front().uri());
msg->header(h_Routes).pop_front();
DebugLog (<< "Looking up dns entries (from route) for " <<
msg->getForceTarget());
result = mDns.lookup(msg->getForceTarget(), handler);
}
It should not pop the route. This will be the job of the downstream proxy to
do as part of its route preprocessing.
Another good point to note is that if there is an entry in the route set,
the UAC should use the topmost entry in the routeset as the target - even if
an outbound proxy has been specified.
Note: This will affect your implementation - but it should only affect it in
a good way!
For reference:
>From 8.1.2
route set with a single URI SHOULD be used instead. If the request
contains a Route header field, the request SHOULD be sent to the
locations derived from its topmost value, but MAY be sent to any
server that the UA is certain will honor the Route and Request-URI
policies specified in this document (as opposed to those in RFC
2543). In particular, a UAC configured with an outbound proxy SHOULD
attempt to send the request to the location indicated in the first
Route header field value instead of adopting the policy of sending
all messages to the outbound proxy.
>From 12.2.1.1
The UAC uses the remote target and route set to build the Request-URI
and Route header field of the request.
If the route set is empty, the UAC MUST place the remote target URI
into the Request-URI. The UAC MUST NOT add a Route header field to
the request.
If the route set is not empty, and the first URI in the route set
contains the lr parameter (see Section 19.1.1), the UAC MUST place
the remote target URI into the Request-URI and MUST include a Route
header field containing the route set values in order, including all
parameters.
If the route set is not empty, and its first URI does not contain the
lr parameter, the UAC MUST place the first URI from the route set
into the Request-URI, stripping any parameters that are not allowed
in a Request-URI. The UAC MUST add a Route header field containing
the remainder of the route set values in order, including all
parameters. The UAC MUST then place the remote target URI into the
Route header field as the last value.