#2197 defect new
[SIP] wrong assertion in MessagesParser.dataDone
|Reported by:||Antoine Pitrou||Owned by:||washort|
|Cc:||therve, Jean-Paul Calderone, Adam||Branch:|
At the end of the method twisted.protocols.sip:MessagesParser.dataDone(), the number of currently received bytes is compared to the declared content-length. The stated aim is to distinguish "aborted" packets/datagrams (received bytes < content length) from internal errors. However, the comparison in line 533 does exactly the reverse, and raises a RuntimeError when an "aborted" packet is received.
To fix the bug, "
self.length < self.bodyReceived" in that line must be changed to "
self.length > self.bodyReceived".
To test for this behaviour, add the following method to MessageParsingTestCase in test_sip.py:
def testIncomplete(self): # test for "aborted" request (body shorter than content-length) l = self.l self.feedMessage(request4[:-1]) self.assertEquals(len(l), 2)
Change History (10)
comment:1 Changed 11 years ago by
|Priority:||normal → highest|
comment:2 follow-ups: 3 4 Changed 11 years ago by
|Cc:||Jean-Paul Calderone added|
|Owner:||set to washort|