[reSIProcate] multiple values in single-value headers are allowed

Byron Campen bcampen at estacado.net
Fri Aug 4 13:22:09 CDT 2006


	SipMessage will allow multiple header-field-values in a single-value  
header, and will re-encode these extra headers. Furthermore, the  
SipMessage::header() interface cannot be used to discover whether  
these extra header-field-values are present.

*snip*
In case multi01:
Original text:
INVITE sip:user at company.com SIP/2.0
Contact: <sip:caller at host25.example.net>
Via: SIP/2.0/UDP 192.0.2.25;branch=z9hG4bKkdjuw
Max-Forwards: 70
CSeq: 5 INVITE
Call-ID: multi01.98asdh at 192.0.2.1
CSeq: 59 INVITE
Call-ID: multi01.98asdh at 192.0.2.2
From: sip:caller at example.com;tag=3413415
To: sip:user at example.com
To: sip:other at example.net
From: sip:caller at example.net;tag=2923420123
Content-Type: application/sdp
l: 154
Contact: <sip:caller at host36.example.net>
Max-Forwards: 5

v=0
o=mhandley 29739 7272939 IN IP4 192.0.2.25
s=-
c=IN IP4 192.0.2.25
t=0 0
m=audio 49217 RTP/AVP 0 12
m=video 3227 RTP/AVP 31
a=rtpmap:31 LPC


Encoded form:
INVITE sip:user at company.com SIP/2.0
Via: SIP/2.0/UDP 192.0.2.25;branch=z9hG4bKkdjuw
Max-Forwards: 70
Max-Forwards: 5
Contact: <sip:caller at host25.example.net>
Contact: <sip:caller at host36.example.net>
To: <sip:user at example.com>
To: <sip:other at example.net>
From: <sip:caller at example.com>;tag=3413415
From: <sip:caller at example.net>;tag=2923420123
Call-ID: multi01.98asdh at 192.0.2.1
Call-ID: multi01.98asdh at 192.0.2.2
CSeq: 5 INVITE
CSeq: 59 INVITE
Content-Type: application/sdp
Content-Length: 154

v=0
o=mhandley 29739 7272939 IN IP4 192.0.2.25
s=-
c=IN IP4 192.0.2.25
t=0 0
m=audio 49217 RTP/AVP 0 12
m=video 3227 RTP/AVP 31
a=rtpmap:31 LPC
*snip*

Relevant code:

in SipMessage::addHeader()
*snip*
    if (header != Headers::UNKNOWN)
    {
       if (mHeaders[header] == 0)
       {
          mHeaders[header] = new HeaderFieldValueList;
       }
       if (len)
       {
          mHeaders[header]->push_back(new HeaderFieldValue(start, len));
       }
    }
*snip*

In HeaderFieldValueList::encode()
*snip*
       if (!headerName.empty())
       {
          str << headerName << Symbols::COLON[0] << Symbols::SPACE[0];
       }

       for (HeaderFieldValueList::const_iterator j = begin();
            j != end(); j++)
       {
          if (j != begin())
          {
             if (Headers::isCommaEncoding(static_cast<Headers::Type> 
(headerEnum)))
             {
                str << Symbols::COMMA[0] << Symbols::SPACE[0];
             }
             else
             {
                str << Symbols::CRLF << headerName << Symbols::COLON  
<< Symbols::SPACE;
             }
          }
          (*j)->encode(str);
       }
       str << Symbols::CRLF;

*snip*


I suggest that we prevent these extraneous headers from being added  
successfully.

Best regards,
Byron Campen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060804/849933cc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2369 bytes
Desc: not available
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20060804/849933cc/attachment.bin>


More information about the resiprocate-devel mailing list