Opened 8 years ago

Closed 2 years ago

#2198 enhancement closed fixed (fixed)

[SIP] patch for multiline headers

Reported by: antoine Owned by: exarkun
Priority: normal Milestone:
Component: core Keywords:
Cc: thijs, moijes12@… Branch: branches/sip-multiline-2198
(diff, github, buildbot, log)
Author: exarkun Launchpad Bug:

Description

Here is a patch for multiline headers.

For unit testing, add the following at the beginning of test_sip.py:

# multiline headers (example from RFC 3261)
response_multiline = """\
SIP/2.0 200 OK
Via: SIP/2.0/UDP server10.biloxi.com
    ;branch=z9hG4bKnashds8;received=192.0.2.3
Via: SIP/2.0/UDP bigbox3.site3.atlanta.com
    ;branch=z9hG4bK77ef4c2312983.1;received=192.0.2.2
Via: SIP/2.0/UDP pc33.atlanta.com
    ;branch=z9hG4bK776asdhds ;received=192.0.2.1
To: Bob <sip:bob@biloxi.com>;tag=a6c85cf
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710@pc33.atlanta.com
CSeq: 314159 INVITE
Contact: <sip:bob@192.0.2.4>
Content-Type: application/sdp
Content-Length: 0
\n""".replace("\n", "\r\n")

and then the following method in MessageParsingTestCase:

    def testMultiLine(self):
        l = self.l
        self.feedMessage(response_multiline)
        self.assertEquals(len(l), 1)
        m = l[0]
        self.assertEquals(m.headers['via'][0],
            "SIP/2.0/UDP server10.biloxi.com;branch=z9hG4bKnashds8;received=192.0.2.3")
        self.assertEquals(m.headers['via'][2],
            "SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds ;received=192.0.2.1")

Attachments (3)

patch-sip-multiline.txt (2.2 KB) - added by antoine 8 years ago.
patch to enable multiline headers for SIP
Twisted_2198.patch (3.9 KB) - added by moijes12 3 years ago.
Taken code(both fix and tests) written by Antoine and put it in a patch. Done nothing new.
Twisted_2198.2.patch (4.2 KB) - added by moijes12 3 years ago.
I hadn't attached the news file.

Download all attachments as: .zip

Change History (12)

Changed 8 years ago by antoine

patch to enable multiline headers for SIP

comment:1 Changed 8 years ago by glyph

  • Owner changed from glyph to washort

Say something about Sine, maybe.

comment:2 Changed 6 years ago by thijs

  • Cc thijs added

We need unit tests in order to include it into the trunk.

comment:3 Changed 4 years ago by <automation>

  • Owner washort deleted

Changed 3 years ago by moijes12

Taken code(both fix and tests) written by Antoine and put it in a patch. Done nothing new.

comment:4 Changed 3 years ago by moijes12

  • Keywords review added

The test case runs though. I did not want to run the entire set of unit tests as it would required me to uninstall twisted from my system first. Please tell me a if you know of another way.

Changed 3 years ago by moijes12

I hadn't attached the news file.

comment:5 Changed 2 years ago by moijes12

  • Cc moijes12@… added

comment:6 Changed 2 years ago by exarkun

  • Keywords review removed
  • Owner set to exarkun

Thanks. The patch contains some very simple problems, like the misnamed and undocumented test method, and lines that are too long. Please check for these easy things before submitting a patch for review.

The change to the parsing seems fine to me. I'll make the coding standard fixes and apply. Thanks again.

comment:7 Changed 2 years ago by exarkun

  • Author set to exarkun
  • Branch set to branches/sip-multiline-2198

(In [34505]) Branching to 'sip-multiline-2198'

comment:8 Changed 2 years ago by exarkun

(In [34506]) Apply patch, plus coding standard fixes
refs #2198

comment:9 Changed 2 years ago by exarkun

  • Resolution set to fixed
  • Status changed from new to closed

(In [34507]) Merge sip-multiline-2198

Author: antoine
Reviewer: exarkun
Fixes: #2198

Add logic for parsing multiline headers in SIP messages.

Note: See TracTickets for help on using tickets.