[reSIProcate] From header valid?

Byron Campen bcampen at estacado.net
Thu Nov 16 22:01:00 CST 2006


	SipMessage::addHeader() is not intended to be used directly like  
that; this is the method that the pre-parser uses to add headers.  
Adding a header in this way carries a couple of special consequences:  
first, the buffer specified by "value" is not owned by the header  
that is created, but it must persist for the lifetime of the  
SipMessage (the header is an overlay), and second, the parse of the  
header will not be carried out until something attempts to access it.  
The preferred method for adding a header to a SipMessage is something  
like the following:

*snip*
NameAddr from("sip:user at host.com");
sipMessage.header(h_From)=from;
*snip*

Best regards,
Byron Campen

> Hello,
> to add the header to the message I am doing :
> message->addHeader(Headers::getType(name, nameLength), name,  
> nameLength, value, valueLength);
> where name = "from" and value = "user at host.com"
>
> So this header should not be valid right?
> I am thinking about adding  a test after addHeader to force the  
> parsing.
> What do you think?
>
> Thanks for your help :-)
> Julien
>
> Byron Campen a écrit :
>>     You're probably tripping over the lazy-parser somehow. If this  
>> comes off the wire, it will not be parsed until you try to start  
>> accessing parts of it. Adding a parameter in this case will  
>> trigger a parse, and the parse will fail. However, if you are  
>> creating this NameAddr manually, how are you constructing it?
>>
>> Best regards,
>> Byron Campen
>>
>>> Hello,
>>> Sorry I have a small question, could one of you tell me,
>>> if this is a valid from header?
>>> From: user at host.com
>>>
>>> Sorry to ask that, resiprocate generates a parse error when I try  
>>> to add
>>> the "tag=", (probably complaining about missing scheme)
>>> but does not complain if I send a message as it is. (Why is that?)
>>>
>>> Thank you for your help
>>>
>>> --Julien Saito
>>> ジュリアン 齋藤
>>> julien at aplix.co.jp
>>>
>>>
>>> _______________________________________________
>>> resiprocate-devel mailing list
>>> resiprocate-devel at list.sipfoundry.org
>>> https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel
>>
>>
>>
>
>
> -- 
> Julien Saito
> ジュリアン 齋藤
> julien at aplix.co.jp
>
>





More information about the resiprocate-devel mailing list