summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2016-04-20 01:58:15 +0000
committerLiong Sauw Ming <ming@teluu.com>2016-04-20 01:58:15 +0000
commit4c2a411e16ec00e47665e9dbefd03846131d7b48 (patch)
treecf8243c87461ce60f77a07c16550dfd5e2539d62
parent9e2f44b8d57afac45d0b20f514458f873ca5f00b (diff)
Re #1882 (misc): Removed stripping of '[]' from pvalue header parameters.
The stripping of '[]' from header parameters causes issues if something (like a port) occurrs after the final ']'. '[2001:a::b]' will correctly parse to '2001:a::b' '[2001:a::b]:8080' will correctly parse to '2001:a::b' but the scanner is left with ':8080' and parsing stops with a syntax error. Thanks to Anthony Messina and George Joseph for the patch. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5280 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsip/sip_parser.c14
-rw-r--r--pjsip/src/test/uri_test.c4
2 files changed, 11 insertions, 7 deletions
diff --git a/pjsip/src/pjsip/sip_parser.c b/pjsip/src/pjsip/sip_parser.c
index c18faa3d..cf3b879f 100644
--- a/pjsip/src/pjsip/sip_parser.c
+++ b/pjsip/src/pjsip/sip_parser.c
@@ -1149,14 +1149,18 @@ static void parse_param_imp( pj_scanner *scanner, pj_pool_t *pool,
pvalue->ptr++;
pvalue->slen -= 2;
}
- } else if (*scanner->curptr == '[') {
+ // } else if (*scanner->curptr == '[') {
/* pvalue can be a quoted IPv6; in this case, the
* '[' and ']' quote characters are to be removed
- * from the pvalue.
+ * from the pvalue.
+ *
+ * Update: this seems to be unnecessary and may cause
+ * parsing error for cases such as IPv6 reference with
+ * port number.
*/
- pj_scan_get_char(scanner);
- pj_scan_get_until_ch(scanner, ']', pvalue);
- pj_scan_get_char(scanner);
+ // pj_scan_get_char(scanner);
+ // pj_scan_get_until_ch(scanner, ']', pvalue);
+ // pj_scan_get_char(scanner);
} else if(pj_cis_match(spec, *scanner->curptr)) {
parser_get_and_unescape(scanner, pool, spec, esc_spec, pvalue);
}
diff --git a/pjsip/src/test/uri_test.c b/pjsip/src/test/uri_test.c
index 9f0fd804..8b7c3a5f 100644
--- a/pjsip/src/test/uri_test.c
+++ b/pjsip/src/test/uri_test.c
@@ -722,7 +722,7 @@ static pjsip_uri *create_uri35( pj_pool_t *pool )
url = pjsip_sip_uri_create(pool, 0);
url->user = pj_str("user");
url->host = pj_str("::1");
- url->maddr_param = pj_str("::01");
+ url->maddr_param = pj_str("[::01]");
return (pjsip_uri*)url;
}
@@ -732,7 +732,7 @@ static pjsip_uri *create_uri36( pj_pool_t *pool )
pjsip_sip_uri *url;
url = pjsip_sip_uri_create(pool, 0);
url->host = pj_str("::1");
- url->maddr_param = pj_str("::01");
+ url->maddr_param = pj_str("[::01]");
return (pjsip_uri*)url;
}