From 3c7408222acbc04151cb7fe2229ce992a6667a3d Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 5 Jul 2006 21:42:45 +0000 Subject: Fixed SIP parsing bugs when in-place escaping is enabled git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@587 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/test-pjsip/uri_test.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'pjsip/src/test-pjsip/uri_test.c') diff --git a/pjsip/src/test-pjsip/uri_test.c b/pjsip/src/test-pjsip/uri_test.c index 1d2d9981..d2e55f20 100644 --- a/pjsip/src/test-pjsip/uri_test.c +++ b/pjsip/src/test-pjsip/uri_test.c @@ -685,16 +685,26 @@ static pj_status_t do_uri_test(pj_pool_t *pool, struct uri_test *entry) { pj_status_t status; int len; + char *input; pjsip_uri *parsed_uri, *ref_uri; pj_str_t s1 = {NULL, 0}, s2 = {NULL, 0}; pj_timestamp t1, t2; - entry->len = pj_native_strlen(entry->str); + if (entry->len == 0) + entry->len = pj_native_strlen(entry->str); + +#if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 + input = pj_pool_alloc(pool, entry->len + 1); + pj_memcpy(input, entry->str, entry->len); + input[entry->len] = '\0'; +#else + input = entry->str; +#endif /* Parse URI text. */ pj_get_timestamp(&t1); var.parse_len = var.parse_len + entry->len; - parsed_uri = pjsip_parse_uri(pool, entry->str, entry->len, 0); + parsed_uri = pjsip_parse_uri(pool, input, entry->len, 0); if (!parsed_uri) { /* Parsing failed. If the entry says that this is expected, then * return OK. @@ -703,7 +713,7 @@ static pj_status_t do_uri_test(pj_pool_t *pool, struct uri_test *entry) if (status != 0) { PJ_LOG(3,(THIS_FILE, " uri parse error!\n" " uri='%s'\n", - entry->str)); + input)); } goto on_return; } -- cgit v1.2.3