diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-04-29 18:07:53 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-04-29 18:07:53 +0000 |
commit | a725180786c8f66bb3d4184b8e2d08d8f9cce66c (patch) | |
tree | 09546363fbfcba33e9e4e1025dff21533c13cb02 | |
parent | cf5812257dc6f466b21d6181c12bb4f934ea11ed (diff) |
Continuing ticket #240: Error parsing quoted URI parameters
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1228 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsip/sip_parser.c | 10 | ||||
-rw-r--r-- | pjsip/src/test-pjsip/msg_test.c | 12 |
2 files changed, 15 insertions, 7 deletions
diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c index 34cb22bc..ea24a71a 100644 --- a/pjsip/src/pjsip/sip_parser.c +++ b/pjsip/src/pjsip/sip_parser.c @@ -143,7 +143,8 @@ static void int_parse_param( pj_scanner *scanner, static void int_parse_uri_param( pj_scanner *scanner, pj_pool_t *pool, pj_str_t *pname, - pj_str_t *pvalue); + pj_str_t *pvalue, + unsigned option); static void int_parse_hparam( pj_scanner *scanner, pj_pool_t *pool, pj_str_t *hname, @@ -1130,14 +1131,15 @@ static void int_parse_param( pj_scanner *scanner, pj_pool_t *pool, /* Parse parameter (";" pname ["=" pvalue]) in URI. */ static void int_parse_uri_param( pj_scanner *scanner, pj_pool_t *pool, - pj_str_t *pname, pj_str_t *pvalue) + pj_str_t *pname, pj_str_t *pvalue, + unsigned option) { /* Get ';' character */ pj_scan_get_char(scanner); /* Get pname and optionally pvalue */ pjsip_parse_uri_param_imp(scanner, pool, pname, pvalue, - PJSIP_PARSE_REMOVE_QUOTE); + option); } @@ -1356,7 +1358,7 @@ static void* int_parse_sip_url( pj_scanner *scanner, while (*scanner->curptr == ';' ) { pj_str_t pname, pvalue; - int_parse_uri_param( scanner, pool, &pname, &pvalue); + int_parse_uri_param( scanner, pool, &pname, &pvalue, 0); if (!parser_stricmp(pname, pjsip_USER_STR) && pvalue.slen) { url->user_param = pvalue; diff --git a/pjsip/src/test-pjsip/msg_test.c b/pjsip/src/test-pjsip/msg_test.c index 3e619099..04c2993c 100644 --- a/pjsip/src/test-pjsip/msg_test.c +++ b/pjsip/src/test-pjsip/msg_test.c @@ -802,7 +802,7 @@ static int hdr_test_via(pjsip_hdr *h); #define GENERIC_PARAM_PARSED "p0=a;p1=\"ab:;cd\";p2=ab:cd;p3" #define PARAM_CHAR "[]/:&+$" #define SIMPLE_ADDR_SPEC "sip:host" -#define ADDR_SPEC SIMPLE_ADDR_SPEC ";" PARAM_CHAR "=" PARAM_CHAR +#define ADDR_SPEC SIMPLE_ADDR_SPEC ";"PARAM_CHAR"="PARAM_CHAR ";p1=\";\"" #define NAME_ADDR "<" ADDR_SPEC ">" #define HDR_FLAG_PARSE_FAIL 1 @@ -1113,7 +1113,7 @@ static int test_simple_addr_spec(pjsip_uri *uri) /* #define PARAM_CHAR "[]/:&+$" #define SIMPLE_ADDR_SPEC "sip:host" -#define ADDR_SPEC SIMPLE_ADDR_SPEC ";" PARAM_CHAR "=" PARAM_CHAR +#define ADDR_SPEC SIMPLE_ADDR_SPEC ";"PARAM_CHAR"="PARAM_CHAR ";p1=\";\"" #define NAME_ADDR "<" ADDR_SPEC ">" */ static int nameaddr_test(pjsip_uri *uri) @@ -1129,7 +1129,7 @@ static int nameaddr_test(pjsip_uri *uri) if (rc != 0) return rc; - if (pj_list_size(&sip_uri->other_param) != 1) + if (pj_list_size(&sip_uri->other_param) != 2) return -940; param = sip_uri->other_param.next; @@ -1140,6 +1140,12 @@ static int nameaddr_test(pjsip_uri *uri) if (pj_strcmp2(¶m->value, PARAM_CHAR)) return -943; + param = param->next; + if (pj_strcmp2(¶m->name, "p1")) + return -942; + if (pj_strcmp2(¶m->value, "\";\"")) + return -943; + return 0; } |