< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [reSIProcate] From header valid?


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@xxxxxxxx");
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@xxxxxxxx"

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@xxxxxxxx

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@xxxxxxxxxxx


_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxxxxxx
https://list.sipfoundry.org/mailman/listinfo/resiprocate-devel





--
Julien Saito
ジュリアン 齋藤
julien@xxxxxxxxxxx