#2220 defect new
[SIP] parsing bugs/limitations and patch
|Reported by:||Antoine Pitrou||Owned by:|
This is a new ticket to solve a set of parsing-related bugs/limitations in the SIP protocol implementation.
The bugs are :
- parseViaHeader() throws an exception when it encounters a parameter it doesn't know about; the proper way to handle this is to ignore unknown params rather than refusing to construct the Via object
The attached patch against the trunk fixes all 4 bugs, and it adds 4 test cases (one for each bug). The function parseViaHeader() also becomes an alias for the class method Via.fromString(), which means we can now subclass the Via class, and use the parsing method as-is (by calling MyViaSubclass.fromString()).
I first tried the approach suggested by JP, which is to backport stuff from divmod Sine, but:
- it is too uncertain and too much work (no documentation, behaviour may be slightly different)
- the aforementioned bugs, apart from multiline header parsing, do exist in the Sine implementation as well
- we don't know whether and in which direction divmod Sine will evolve anyway, so there is no clear benefit in trying to follow it