Ticket #2198 enhancement closed fixed

Opened 7 years ago

Last modified 12 months ago

[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
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

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

Change History

Changed 7 years ago by antoine

patch to enable multiline headers for SIP

1

Changed 6 years ago by glyph

  • owner changed from glyph to washort

Say something about Sine, maybe.

2

Changed 5 years ago by thijs

  • cc thijs added

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

3

Changed 2 years ago by <automation>

  • owner washort deleted

Changed 13 months ago by moijes12

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

4

Changed 13 months 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 13 months ago by moijes12

I hadn't attached the news file.

5

Changed 13 months ago by moijes12

  • cc moijes12@… added

6

Changed 12 months 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.

7

Changed 12 months ago by exarkun

  • branch set to branches/sip-multiline-2198
  • branch_author set to exarkun

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

8

Changed 12 months ago by exarkun

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

9

Changed 12 months ago by exarkun

  • status changed from new to closed
  • resolution set to fixed

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