SIP: header names in compact form are not read #2

Closed
opened 2026-11-19 11:07:54 +00:00 by jorijnvdgraaf · 1 comment

RFC 3261 7.3.3 lets a sender write a header name in its one-letter form "at any time" (v Via, f From, t To, i Call-ID, m Contact, c Content-Type, l Content-Length, k Supported, e Content-Encoding, s Subject), and says: "Implementations MUST accept both the long and short forms of each header name."

imsd's text layer matches the long name only (MatchHeaderLine, interfaces/Imsd-Sip.cppm). To every reader, a header sent in compact form is absent:

  • The TCP framer takes a body's length from Content-Length (FrameBuffer::TryExtract). A message that says l: is cut after its headers, and its body is read as the start of the next message.
  • A response is matched to its transaction, and a request to the call, by Call-ID (ResponseOf, DispatchRequest). With i: a response matches no transaction of ours and a request no call.
  • The finals imsd builds copy Via, From, To, Call-ID and CSeq from the request (BuildResponse200, BuildInviteResponse; from 1.2.0 BuildResponse). One that came in compact form is left out of the answer.
  • From 1.2.0, SMS over IMS: a MESSAGE whose content type comes as c: is not taken for a short message — it is answered 200 and logged with its body, not handed to the bus and not acknowledged with an RP-ACK. One whose Call-ID comes as i: gets a delivery report without In-Reply-To. One whose Via comes as v: is never recognised as a retransmission.

None of the SIP messages captured from KPN, the network imsd is benched on, uses a compact form, and a core that used them throughout would not get imsd as far as a registration. The case that matters is a network element that uses them in some requests only.

1.2.0's AGENTS.md says so (§2: "the text layer reads long header names only"; §7.9). Before that the documents do not mention it.

What a fix needs:

  • The matcher takes a header by either form: RFC 3261's ten compact forms, and those of the extension headers imsd reads (o for Event and x for Session-Expires are two).
  • tests/Sip pins each form through Header, Headers, the framer and DatagramMessage, and the suites that drive requests through the reducers get a fixture in compact form.
  • The sentences that say long names only are taken out.
RFC 3261 7.3.3 lets a sender write a header name in its one-letter form "at any time" (`v` Via, `f` From, `t` To, `i` Call-ID, `m` Contact, `c` Content-Type, `l` Content-Length, `k` Supported, `e` Content-Encoding, `s` Subject), and says: "Implementations MUST accept both the long and short forms of each header name." imsd's text layer matches the long name only (`MatchHeaderLine`, `interfaces/Imsd-Sip.cppm`). To every reader, a header sent in compact form is absent: - The TCP framer takes a body's length from `Content-Length` (`FrameBuffer::TryExtract`). A message that says `l:` is cut after its headers, and its body is read as the start of the next message. - A response is matched to its transaction, and a request to the call, by `Call-ID` (`ResponseOf`, `DispatchRequest`). With `i:` a response matches no transaction of ours and a request no call. - The finals imsd builds copy `Via`, `From`, `To`, `Call-ID` and `CSeq` from the request (`BuildResponse200`, `BuildInviteResponse`; from 1.2.0 `BuildResponse`). One that came in compact form is left out of the answer. - From 1.2.0, SMS over IMS: a MESSAGE whose content type comes as `c:` is not taken for a short message — it is answered 200 and logged with its body, not handed to the bus and not acknowledged with an RP-ACK. One whose Call-ID comes as `i:` gets a delivery report without `In-Reply-To`. One whose Via comes as `v:` is never recognised as a retransmission. None of the SIP messages captured from KPN, the network imsd is benched on, uses a compact form, and a core that used them throughout would not get imsd as far as a registration. The case that matters is a network element that uses them in some requests only. 1.2.0's AGENTS.md says so (§2: "the text layer reads long header names only"; §7.9). Before that the documents do not mention it. What a fix needs: - The matcher takes a header by either form: RFC 3261's ten compact forms, and those of the extension headers imsd reads (`o` for Event and `x` for Session-Expires are two). - tests/Sip pins each form through `Header`, `Headers`, the framer and `DatagramMessage`, and the suites that drive requests through the reducers get a fixture in compact form. - The sentences that say long names only are taken out.
Author
Owner

Fixed in 1.2.1. A header is found under its compact form — the ten RFC 3261 defines, o for Event and x for Session-Expires — and with white space before the colon (1267fe1). In the same release: a response's CSeq is compared as its number and its method (78c7025), both framers read a Content-Length as a number (c81dd3d), and a header value folded over several lines is read whole (9333621).

Fixed in 1.2.1. A header is found under its compact form — the ten RFC 3261 defines, `o` for Event and `x` for Session-Expires — and with white space before the colon (1267fe1). In the same release: a response's CSeq is compared as its number and its method (78c7025), both framers read a Content-Length as a number (c81dd3d), and a header value folded over several lines is read whole (9333621).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Catcrafts/imsd#2
No description provided.