e.g., if I want to do something if there is a Refer-To header in the message, am I better off doing avp_printf("$someAvp", "$rt"); avp_check("$rt", "re/.../i");
or
search("/.../"); Just want ot know whether to get started rewriting all the "search()" strings i have in my ser.cfg....
cheers
Hi Kanakatti,
IMHO , the first approach should be faster and saver.
why faster? instead of applying re over the entire message (as search does), you will limit to the hdr body. Parsing to extract the hdr is also more faster (and usualy means just walking over the hdr list, since the msg may be already parsed).
why saver? re to match exactly the hdr and the check the body, excepting that are complex and slow, may fail and do wrong matching - the internal hdr parser cannot fail and always identify precisely the hdr.
regards, bogdan
Kanakatti M. Subramanya wrote:
e.g., if I want to do something if there is a Refer-To header in the message, am I better off doing avp_printf("$someAvp", "$rt"); avp_check("$rt", "re/.../i");
or
search("/.../"); Just want ot know whether to get started rewriting all the "search()" strings i have in my ser.cfg....
cheers
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
If you want just to check if there is a Refer-To header, you can use the function is_present_hf() from textops module. This is the fastest way to check if a header exists.
Daniel
On 08/24/05 16:12, Kanakatti M. Subramanya wrote:
e.g., if I want to do something if there is a Refer-To header in the message, am I better off doing avp_printf("$someAvp", "$rt"); avp_check("$rt", "re/.../i");
or
search("/.../"); Just want ot know whether to get started rewriting all the "search()" strings i have in my ser.cfg....
cheers
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
True. and agreed.
I was actually trying to be more general, i.e., if I wanted to do some processing on the contents of a specific header, would it be more efficient to extract that header using avp_printf(), and then search within it, as compared to just searching on the whole message
The answer, as it turns out, is that yes it is probably faster (limited to walking through and extracting just the header), and safer (less chance of matching against something else altogether)
thanx
Daniel-Constantin Mierla wrote:
If you want just to check if there is a Refer-To header, you can use the function is_present_hf() from textops module. This is the fastest way to check if a header exists.
Daniel
On 08/24/05 16:12, Kanakatti M. Subramanya wrote:
e.g., if I want to do something if there is a Refer-To header in the message, am I better off doing avp_printf("$someAvp", "$rt"); avp_check("$rt", "re/.../i");
or
search("/.../"); Just want ot know whether to get started rewriting all the "search()" strings i have in my ser.cfg....
cheers
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
Hi Kanakatti,
for extracting an hdr into an AVP, you can use avp_write() instead of avp_printf() - it's faster since it's not so complex ;)
regards, bogdan
Kanakatti Mahesh Subramanya wrote:
True. and agreed.
I was actually trying to be more general, i.e., if I wanted to do some processing on the contents of a specific header, would it be more efficient to extract that header using avp_printf(), and then search within it, as compared to just searching on the whole message
The answer, as it turns out, is that yes it is probably faster (limited to walking through and extracting just the header), and safer (less chance of matching against something else altogether)
thanx
Daniel-Constantin Mierla wrote:
If you want just to check if there is a Refer-To header, you can use the function is_present_hf() from textops module. This is the fastest way to check if a header exists.
Daniel
On 08/24/05 16:12, Kanakatti M. Subramanya wrote:
e.g., if I want to do something if there is a Refer-To header in the message, am I better off doing avp_printf("$someAvp", "$rt"); avp_check("$rt", "re/.../i");
or
search("/.../"); Just want ot know whether to get started rewriting all the "search()" strings i have in my ser.cfg....
cheers
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
Daniel-Constantin Mierla writes:
If you want just to check if there is a Refer-To header, you can use the function is_present_hf() from textops module. This is the fastest way to check if a header exists.
this reminds me about the thing that is_present_hf() implementation is not very efficient, because it compares header names as strings. this could be turned into type comparison with aid of a fixup function (for all hfs known to ser).
-- juha
On 08/25/05 18:39, Juha Heinanen wrote:
Daniel-Constantin Mierla writes:
If you want just to check if there is a Refer-To header, you can use the function is_present_hf() from textops module. This is the fastest way to check if a header exists.
this reminds me about the thing that is_present_hf() implementation is not very efficient, because it compares header names as strings. this could be turned into type comparison with aid of a fixup function (for all hfs known to ser).
this is already done since first openser release - textops module uses types for is_present_hf() and remove_hf() - but it seems we forgot to add this update in the release info.
Daniel
-- juha
Daniel-Constantin Mierla writes:
this is already done since first openser release - textops module uses types for is_present_hf() and remove_hf() - but it seems we forgot to add this update in the release info.
i checked and, indeed, this is true. it is ser that still uses string comparisons.
-- juha