Support overlapping SIP&HTTP headers in WS HTTP initial requests #3237
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.
Summary
Support overlapping SIP&HTTP headers in WS HTTP initial requests
Details
HTTP proxies can sometimes add VIA header to the HTTP request switching from WS to SIP. Since we are using the SIP parser to go over a HTTP request, that will fail with :
Oct 30 13:08:01 vlad-x1carbon ./opensips[31764]: ERROR:core:parse_via: bad char on state 100
Oct 30 13:08:01 vlad-x1carbon ./opensips[31764]: ERROR:core:parse_via: <HTTP/1.1 test@localhost#015#012#015#012>
Oct 30 13:08:01 vlad-x1carbon ./opensips[31764]: ERROR:core:parse_via: via parse failed
Oct 30 13:08:01 vlad-x1carbon ./opensips[31764]: ERROR:core:get_hdr_field: bad via
Oct 30 13:08:01 vlad-x1carbon ./opensips[31764]: INFO:core:parse_headers: bad header field
Steps to reproduce :
Solution
Introduce a flag in parser to decide if we want to internally implicit parse well-known SIP headers ( current list is VIA / TO / Content-Length / CSEQ ) & add a define to always parse ( aka. assume SIP context ). From WS HTTP contexts, do not parse those.
Compatibility
Should not affect anything
Closing issues
Opening PR to make sure we are all in agreement with the solution here.