### Description According to [RFC3261](https://datatracker.ietf.org/doc/html/rfc3261#section-20.14)
The Content-Length header field indicates the size of the message- body, in decimal number of octets, sent to the recipient. Applications SHOULD use this field to indicate the size of the message-body to be transferred, regardless of the media type of the entity. If a stream-based protocol (such as TCP) is used as transport, the header field MUST be used.
When UDP protocol is used then this header is optional. When Kamailio receives an OPTIONS request like in the example, then it floods Kamailio logs with messages like ``` sanity [sanity.c:612]: check_cl(): content length header missing in request ```
OPTIONS message example ``` OPTIONS sip:sbc-0.example.com:5060 SIP/2.0 Via: SIP/2.0/UDP 64.58.61.151:5060;branch=z9hG4bKl7oo3f30a0som61aeu00 Call-ID: 49bc1fcac14b779958dad4b9c43954b400149n2@64.58.61.151 To: sip:ping@sbc-0.example.com From: sip:ping@64.58.61.151;tag=8fbe5af9178677655bc3a5388c2a8b8c00149n2 Max-Forwards: 70 CSeq: 299694 OPTIONS Route: sip:3.236.25.4:5060;lr ```
### Expected behavior Do not generate warnings about SIP messages that are allowed according to RFC.
#### Actual observed behavior Generated warning when "Content-Length" header missing and used UDP protocol.
You can switch off this check by using the appropriate flags: [link](https://kamailio.org/docs/modules/5.5.x/modules/sanity.html#sanity.overview)
Its probably a good idea to warn about the missing header when the user activated this check. But it could be of course changed as part of this feature request.
From my point of view, having a condition in the config file is fine, considering that most UAs add Content-Lenght -- it is up to config write to adjust the options/parameters for own eco-system. In many cases lack of Content-Length happens more often due to broken UA processing than UAs not adding it on purpose.
If one wants to add a new flag (or a modparam) to skip this check for UDP (and probably SCTP), I am fine. But if nobody commits soon to do it, then should be closed. A PR can be made at any time.
I will try to create PR. If it is not done next two months then I will close the request.
This issue is stale because it has been open 6 weeks with no activity. Remove stale label or comment or this will be closed in 2 weeks.
Closed #3210 as not planned.