feat: add typed Service-Route (RFC 3608) header - #142
Open
rizwan3659 wants to merge 1 commit into
Open
Conversation
Model Service-Route as a typed header alongside Route/Record-Route: untyped storage, the Header enum wiring and parser dispatch, a typed `ServiceRoute` (display-name, uri, params) reusing the shared name-addr parser and list splitter, and `service_route_headers()` / `typed_service_route_headers()` accessors on HeadersExt. Registration now records the Service-Route set from a REGISTER 200 OK and exposes it via `Registration::service_route()`. This is the route set an IMS S-CSCF advertises for originating requests. Applying it to outgoing requests (preloading Route headers) is intentionally left to the caller, so this change adds no behavioural change to existing dialogs. Adds unit tests for single/multi-value parsing, display round-trip, the typed<->header conversion, and end-to-end extraction from a 200 OK.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds first-class support for the
Service-Routeheader (RFC 3608), modelled on the existingRoute/Record-Routeheaders:ServiceRoutestorage +Headerenum variant,Display, name andvalue()arms, and parser dispatch forService-Route;ServiceRoute(display_name,uri,params) reusing the shared name-addr parser and comma splitter, withparse_header_list,Display, and the usualFromconversions;service_route_headers()/service_route_header()/typed_service_route_headers()onHeadersExt;Registrationrecords the Service-Route set from a REGISTER200 OKand exposes it viaRegistration::service_route().Why
The stack already advertises
Supported: path, outboundon REGISTER but never reads the registrar's answer back. Per RFC 3608, theService-Routeset returned in the REGISTER200 OKis the route set a UA should use for subsequent out-of-dialog requests — in IMS this is the originating route set advertised by the S-CSCF. Today those headers fall through toHeader::Otherand are silently dropped.Scope
This PR only learns and exposes the set. Applying it to outgoing requests (preloading
Routeheaders) changes call behaviour and is intentionally left to the caller / a follow-up, so existing dialogs are unaffected.Tests
Unit tests cover single/multi-value parsing, display round-trip, typed↔header conversion, and end-to-end extraction from a
200 OK.cargo build,cargo fmt --checkandcargo clippyare clean; the full lib suite passes locally (the unrelatedtest_sip_dns_lookupfails in my sandbox because it needs DNS).