Module: sip-router Branch: master Commit: 1a5b6cd11af4ec65148bc06617c33d689dbb5189 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1a5b6cd11af4ec65148bc06617c33d689dbb5189
Author: Andreas Granig <[email protected]> Committer: Andreas Granig <[email protected]> Date: Tue Jun 5 14:29:13 2012 +0200 parser: Also support single-quoted URI params. RFC3261 only allows single-quoted params (no double-quoted ones), however better support both. --- parser/parse_param.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/parser/parse_param.c b/parser/parse_param.c index 986b873..845292a 100644 --- a/parser/parse_param.c +++ b/parser/parse_param.c @@ -266,6 +266,7 @@ static inline void parse_uri_class(param_hooks_t* _h, param_t* _p) static inline int parse_quoted_param(str* _s, str* _r) { char* end_quote; + char quote; /* The string must have at least * surrounding quotes @@ -274,13 +275,18 @@ static inline int parse_quoted_param(str* _s, str* _r) return -1; } + /* Store the kind of quoting (single or double) + * which we're handling with + */ + quote = (_s->s)[0]; + /* Skip opening quote */ _s->s++; _s->len--; /* Find closing quote */ - end_quote = q_memchr(_s->s, '\"', _s->len); + end_quote = q_memchr(_s->s, quote, _s->len); /* Not found, return error */ if (!end_quote) { @@ -415,7 +421,7 @@ static inline void parse_param_name(str* _s, pclass_t _c, param_hooks_t* _h, par */ static inline int parse_param_body(str* _s, param_t* _c) { - if (_s->s[0] == '\"') { + if (_s->s[0] == '\"' || _s->s[0] == '\'') { if (parse_quoted_param(_s, &(_c->body)) < 0) { LOG(L_ERR, "parse_param_body(): Error while parsing quoted string\n"); return -2; _______________________________________________ sr-dev mailing list [email protected] http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
