Opened 16 years ago

Closed 10 years ago

#2198 enhancement closed fixed (fixed)

[SIP] patch for multiline headers

Reported by: Antoine Pitrou Owned by: Jean-Paul Calderone
Priority: normal Milestone:
Component: core Keywords:
Cc: Thijs Triemstra, moijes12 Branch: branches/sip-multiline-2198
branch-diff, diff-cov, branch-cov, buildbot
Author: exarkun

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 Pitrou 16 years ago.
patch to enable multiline headers for SIP
Twisted_2198.patch (3.9 KB) - added by moijes12 10 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 10 years ago.
I hadn't attached the news file.

Download all attachments as: .zip

Change History (12)

Changed 16 years ago by Antoine Pitrou

Attachment: patch-sip-multiline.txt added

patch to enable multiline headers for SIP

comment:1 Changed 15 years ago by Glyph

Owner: changed from Glyph to washort

Say something about Sine, maybe.

comment:2 Changed 14 years ago by Thijs Triemstra

Cc: Thijs Triemstra added

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

comment:3 Changed 11 years ago by <automation>

Owner: washort deleted

Changed 10 years ago by moijes12

Attachment: Twisted_2198.patch added

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

comment:4 Changed 10 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 10 years ago by moijes12

Attachment: Twisted_2198.2.patch added

I hadn't attached the news file.

comment:5 Changed 10 years ago by moijes12

Cc: moijes12 added

comment:6 Changed 10 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Jean-Paul Calderone

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 10 years ago by Jean-Paul Calderone

Author: exarkun
Branch: branches/sip-multiline-2198

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

comment:8 Changed 10 years ago by Jean-Paul Calderone

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

comment:9 Changed 10 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(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.