Index: /pjproject/trunk/pjsip/build/test_pjsip.dsp
===================================================================
--- /pjproject/trunk/pjsip/build/test_pjsip.dsp	(revision 73)
+++ /pjproject/trunk/pjsip/build/test_pjsip.dsp	(revision 74)
@@ -43,5 +43,5 @@
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /Zi /O2 /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "PJ_WIN32" /D "PJ_M_I386" /FR /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /Ob2 /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "PJ_WIN32" /D "PJ_M_I386" /FR /FD /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
Index: /pjproject/trunk/pjsip/include/pjsip/sip_parser.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_parser.h	(revision 73)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_parser.h	(revision 74)
@@ -68,5 +68,5 @@
 {
     PJ_DECL_LIST_MEMBER(struct pjsip_parser_err_report);
-    int		exception_code;	/**< Error exception (e.g. PJSIP_SYN_ERR_EXCEPTION) */
+    int		except_code;	/**< Error exception (e.g. PJSIP_SYN_ERR_EXCEPTION) */
     int		line;		/**< Line number. */
     int		col;		/**< Column number. */
Index: /pjproject/trunk/pjsip/src/pjsip-simple/event_notify.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/event_notify.c	(revision 73)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/event_notify.c	(revision 74)
@@ -337,5 +337,5 @@
 
     }
-    PJ_DEFAULT {
+    PJ_CATCH_ANY {
 	PJ_LOG(4,(THIS_FILE, "event_sub%p (%s): caught exception %d during init", 
 			     sub, state[sub->state].ptr, PJ_GET_EXCEPTION()));
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_dialog.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_dialog.c	(revision 73)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_dialog.c	(revision 74)
@@ -757,5 +757,5 @@
 	PJ_LOG(5, (dlg->obj_name, "request data %s created", tdata->obj_name));
     }
-    PJ_DEFAULT {
+    PJ_CATCH_ANY {
 	/* Failed! Delete transmit data. */
 	if (tdata) {
Index: /pjproject/trunk/pjsip/src/pjsip/sip_parser.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_parser.c	(revision 73)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_parser.c	(revision 74)
@@ -184,5 +184,5 @@
 
 /* Case insensitive comparison */
-#define parser_stricmp(str1, str2)  pj_stricmp(&str1, &str2)
+#define parser_stricmp(s1, s2)  (pj_stricmp_alnum(&s1, &s2))
 
 
@@ -552,5 +552,5 @@
 	msg = int_parse_msg(&context, err_list);
     } 
-    PJ_DEFAULT {
+    PJ_CATCH_ANY {
 	msg = NULL;
     }
@@ -581,5 +581,5 @@
 	rdata->msg_info.msg = int_parse_msg(&context, &rdata->msg_info.parse_err);
     } 
-    PJ_DEFAULT {
+    PJ_CATCH_ANY {
 	rdata->msg_info.msg = NULL;
     }
@@ -657,5 +657,8 @@
 		/* Found a valid Content-Length header. */
 		content_length = pj_strtoul(&str_clen);
-	    } 
+	    }
+	    PJ_CATCH_ANY {
+		content_length = -1;
+	    }
 	    PJ_END
 
@@ -692,7 +695,7 @@
 					 unsigned option)
 {
-    PJ_USE_EXCEPTION;
     pj_scanner scanner;
     pjsip_uri *uri = NULL;
+    PJ_USE_EXCEPTION;
 
     init_sip_parser();
@@ -703,4 +706,7 @@
     PJ_TRY {
 	uri = int_parse_uri_or_name_addr(&scanner, pool, option);
+    }
+    PJ_CATCH_ANY {
+	uri = NULL;
     }
     PJ_END;
@@ -739,5 +745,4 @@
 				 pjsip_parser_err_report *err_list)
 {
-    PJ_USE_EXCEPTION;
     int ch;
     pjsip_msg *msg;
@@ -745,4 +750,5 @@
     pj_scanner *scanner = ctx->scanner;
     pj_pool_t *pool = ctx->pool;
+    PJ_USE_EXCEPTION;
 
     /* Skip leading newlines. */
@@ -801,5 +807,5 @@
 
 	}
-	PJ_DEFAULT {
+	PJ_CATCH_ANY {
 	    /* Exception was thrown during parsing. 
 	     * Skip until newline, and parse next header. 
@@ -816,5 +822,5 @@
 		
 		err_info = pj_pool_alloc(pool, sizeof(*err_info));
-		err_info->exception_code = PJ_GET_EXCEPTION();
+		err_info->except_code = PJ_GET_EXCEPTION();
 		err_info->line = scanner->line;
 		err_info->col = scanner->col;
@@ -1080,8 +1086,7 @@
 {
     pj_str_t scheme;
-    pjsip_url *url;
+    pjsip_url *url = NULL;
     int colon;
     int skip_ws = scanner->skip_ws;
-    int hsep = '?';
     scanner->skip_ws = 0;
 
@@ -1115,5 +1120,6 @@
 
     /* Get URL parameters. */
-    while ( parse_params && *scanner->curptr == ';' ) {
+    if (parse_params) {
+      while (*scanner->curptr == ';' ) {
 	pj_str_t pname, pvalue;
 
@@ -1144,13 +1150,15 @@
 	    pj_list_insert_before(&url->other_param, p);
 	}
+      }
     }
 
     /* Get header params. */
-    while (parse_params && *scanner->curptr == hsep) {
+    if (parse_params && *scanner->curptr == '?') {
+      do {
 	pjsip_param *param;
 	param = pj_pool_alloc(pool, sizeof(pjsip_param));
 	int_parse_hparam(scanner, pool, &param->name, &param->value);
 	pj_list_insert_before(&url->header_param, param);
-	hsep = '&';
+      } while (*scanner->curptr == '&');
     }
 
@@ -1775,5 +1783,5 @@
 
     } 
-    PJ_DEFAULT {
+    PJ_CATCH_ANY {
 	hdr = NULL;
     }
Index: /pjproject/trunk/pjsip/src/pjsip/sip_uri.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_uri.c	(revision 73)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_uri.c	(revision 74)
@@ -47,5 +47,5 @@
     const pjsip_param *p = param_list->next;
     while (p != param_list) {
-	if (pj_stricmp(&p->name, name)==0)
+	if (pj_stricmp_alnum(&p->name, name)==0)
 	    return p;
 	p = p->next;
Index: /pjproject/trunk/pjsip/src/pjsip/sip_util.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_util.c	(revision 73)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_util.c	(revision 74)
@@ -323,5 +323,5 @@
                             contact, call_id, cseq, param_text);
     }
-    PJ_DEFAULT {
+    PJ_CATCH_ANY {
 	status = PJ_ENOMEM;
 	goto on_error;
@@ -394,5 +394,5 @@
                            contact, call_id, cseq, param_text);
     }
-    PJ_DEFAULT {
+    PJ_CATCH_ANY {
 	status = PJ_ENOMEM;
 	goto on_error;
Index: /pjproject/trunk/pjsip/src/test-pjsip/uri.c
===================================================================
--- /pjproject/trunk/pjsip/src/test-pjsip/uri.c	(revision 73)
+++ /pjproject/trunk/pjsip/src/test-pjsip/uri.c	(revision 74)
@@ -30,11 +30,11 @@
 #define PARAM_CHAR  ALPHANUM MARK "[]/:&+$"
 
-#define POOL_SIZE	4000
-#define LOOP_COUNT	1000
+#define POOL_SIZE	8000
+#define LOOP_COUNT	10000
 #define AVERAGE_URL_LEN	80
 #define THREAD_COUNT	4
 
-static pj_uint32_t parse_len;
-static pj_timestamp parse_time, print_time;
+static pj_highprec_t parse_len, print_len, cmp_len;
+static pj_timestamp parse_time, print_time, cmp_time;
 
 
@@ -84,6 +84,5 @@
 	PJ_SUCCESS,
 	"sip:user:password@localhost:5060",
-	&create_uri2,
-    },
+	&create_uri2,    },
     {
 	/* Port is specified should not match unspecified port. */
@@ -499,5 +498,5 @@
     /* Parse URI text. */
     pj_get_timestamp(&t1);
-    parse_len += entry->len;
+    parse_len = parse_len + entry->len;
     parsed_uri = pjsip_parse_uri(pool, entry->str, entry->len, 0);
     if (!parsed_uri) {
@@ -533,4 +532,5 @@
     s1.slen = len;
 
+    print_len = print_len + len;
     pj_get_timestamp(&t2);
     pj_sub_timestamp(&t2, &t1);
@@ -546,4 +546,5 @@
 
     /* Full comparison of parsed URI with reference URI. */
+    pj_get_timestamp(&t1);
     status = pjsip_uri_cmp(PJSIP_URI_IN_OTHER, parsed_uri, ref_uri);
     if (status != 0) {
@@ -566,4 +567,9 @@
     }
 
+    cmp_len = cmp_len + len;
+    pj_get_timestamp(&t2);
+    pj_sub_timestamp(&t2, &t1);
+    pj_add_timestamp(&cmp_time, &t2);
+
     /* Compare text. */
     if (pj_strcmp(&s1, &s2) != 0) {
@@ -582,5 +588,6 @@
     pj_status_t status;
     pj_timestamp zero;
-    pj_highprec_t avg_parse, avg_print;
+    pj_time_val elapsed;
+    pj_highprec_t avg_parse, avg_print, avg_cmp, kbytes;
 
     zero.u32.hi = zero.u32.lo = 0;
@@ -599,9 +606,10 @@
 
     PJ_LOG(3,("", "  benchmarking..."));
-    parse_len = 0;
+    parse_len = print_len = cmp_len = 0;
     parse_time.u32.hi = parse_time.u32.lo = 0;
     print_time.u32.hi = print_time.u32.lo = 0;
-    pool = pjsip_endpt_create_pool(endpt, "", POOL_SIZE, POOL_SIZE);
+    cmp_time.u32.hi = cmp_time.u32.lo = 0;
     for (loop=0; loop<LOOP_COUNT; ++loop) {
+	pool = pjsip_endpt_create_pool(endpt, "", POOL_SIZE, POOL_SIZE);
 	for (i=0; i<PJ_ARRAY_SIZE(uri_test_array); ++i) {
 	    status = do_uri_test(pool, &uri_test_array[i]);
@@ -609,9 +617,15 @@
 		PJ_LOG(3,("uri_test", "  error %d when testing entry %d",
 			  status, i));
+		pjsip_endpt_destroy_pool(endpt, pool);
 		goto on_return;
 	    }
 	}
-    }
-
+	pjsip_endpt_destroy_pool(endpt, pool);
+    }
+
+    kbytes = parse_len;
+    pj_highprec_mod(kbytes, 1000000);
+    pj_highprec_div(kbytes, 100000);
+    elapsed = pj_elapsed_time(&zero, &parse_time);
     avg_parse = pj_elapsed_usec(&zero, &parse_time);
     pj_highprec_mul(avg_parse, AVERAGE_URL_LEN);
@@ -619,4 +633,13 @@
     avg_parse = 1000000 / avg_parse;
 
+    PJ_LOG(3,("", "    %u.%u MB of urls parsed in %d.%03ds (avg=%d urls/sec)", 
+		  (unsigned)(parse_len/1000000), (unsigned)kbytes,
+		  elapsed.sec, elapsed.msec,
+		  (unsigned)avg_parse));
+
+    kbytes = print_len;
+    pj_highprec_mod(kbytes, 1000000);
+    pj_highprec_div(kbytes, 100000);
+    elapsed = pj_elapsed_time(&zero, &print_time);
     avg_print = pj_elapsed_usec(&zero, &print_time);
     pj_highprec_mul(avg_print, AVERAGE_URL_LEN);
@@ -624,6 +647,22 @@
     avg_print = 1000000 / avg_print;
 
-    PJ_LOG(3,("", "   done. Average parse=%d url/sec, print=%d url/sec",
-		  (unsigned)avg_parse, (unsigned)avg_print));
+    PJ_LOG(3,("", "    %u.%u MB of urls printed in %d.%03ds (avg=%d urls/sec)", 
+		  (unsigned)(print_len/1000000), (unsigned)kbytes,
+		  elapsed.sec, elapsed.msec,
+		  (unsigned)avg_print));
+
+    kbytes = cmp_len;
+    pj_highprec_mod(kbytes, 1000000);
+    pj_highprec_div(kbytes, 100000);
+    elapsed = pj_elapsed_time(&zero, &cmp_time);
+    avg_cmp = pj_elapsed_usec(&zero, &cmp_time);
+    pj_highprec_mul(avg_cmp, AVERAGE_URL_LEN);
+    pj_highprec_div(avg_cmp, cmp_len);
+    avg_cmp = 1000000 / avg_cmp;
+
+    PJ_LOG(3,("", "    %u.%u MB of urls compared in %d.%03ds (avg=%d urls/sec)", 
+		  (unsigned)(cmp_len/1000000), (unsigned)kbytes,
+		  elapsed.sec, elapsed.msec,
+		  (unsigned)avg_cmp));
 
     PJ_LOG(3,("", "  multithreaded test"));
@@ -631,5 +670,4 @@
 
 on_return:
-    pjsip_endpt_destroy_pool(endpt, pool);
     return status;
 }
