Module: sip-router Branch: ser_core_cvs Commit: 418a2312875436ca0402f9b0b39831c6353f8403 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=418a2312875436ca0402f9b0b39831c6353f8403
Author: Andrei Pelinescu-Onciul <[email protected]> Committer: Andrei Pelinescu-Onciul <[email protected]> Date: Tue Jul 14 07:40:17 2009 +0000 core: parse_headers flags fix Restore original flags after parse_headers was called with "next" (without restoring them, if parse_headers doesn't find again all the requested headers it will leave their flags cleared although they might be present in the message). --- parser/msg_parser.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/parser/msg_parser.c b/parser/msg_parser.c index a7df061..246b9d8 100644 --- a/parser/msg_parser.c +++ b/parser/msg_parser.c @@ -306,13 +306,15 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next) end=msg->buf+msg->len; tmp=msg->unparsed; - if (next) { + if (unlikely(next)) { orig_flag = msg->parsed_flag; msg->parsed_flag &= ~flags; }else orig_flag=0; +#ifdef EXTRA_DEBUG DBG("parse_headers: flags=%llx\n", (unsigned long long)flags); +#endif while( tmp<end && (flags & msg->parsed_flag) != flags){ prefetch_loc_r(tmp+64, 1); hf=pkg_malloc(sizeof(struct hdr_field)); @@ -538,12 +540,15 @@ int parse_headers(struct sip_msg* msg, hdr_flags_t flags, int next) } skip: msg->unparsed=tmp; + /* restore original flags */ + msg->parsed_flag |= orig_flag; return 0; error: ser_error=E_BAD_REQ; if (hf) pkg_free(hf); - if (next) msg->parsed_flag |= orig_flag; + /* restore original flags */ + msg->parsed_flag |= orig_flag; return -1; } _______________________________________________ sr-dev mailing list [email protected] http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
