Changeset 2522 for pjproject/trunk/pjsip/src/pjsip/sip_parser.c
- Timestamp:
- Mar 18, 2009 6:24:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_parser.c
r2505 r2522 326 326 pj_cis_del_str(&pconst.pjsip_TOKEN_SPEC_ESC, "%"); 327 327 328 status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC, &pconst.pjsip_TOKEN_SPEC); 329 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 330 pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC, ":"); 331 332 status = pj_cis_dup(&pconst.pjsip_VIA_PARAM_SPEC_ESC, &pconst.pjsip_TOKEN_SPEC_ESC); 333 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 334 pj_cis_add_str(&pconst.pjsip_VIA_PARAM_SPEC, ":"); 335 328 336 status = pj_cis_dup(&pconst.pjsip_HOST_SPEC, &pconst.pjsip_ALNUM_SPEC); 329 337 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); … … 771 779 const char *line; 772 780 int content_length = -1; 781 pj_str_t cur_msg; 782 const pj_str_t end_hdr = { "\n\r\n", 3}; 773 783 774 784 *msg_size = size; … … 780 790 781 791 782 /* Find the end of header area by finding an empty line. */ 783 pos = pj_ansi_strstr(buf, "\n\r\n"); 792 /* Find the end of header area by finding an empty line. 793 * Don't use plain strstr() since we want to be able to handle 794 * NULL character in the message 795 */ 796 cur_msg.ptr = (char*)buf; cur_msg.slen = size; 797 pos = pj_strstr(&cur_msg, &end_hdr); 784 798 if (pos == NULL) { 785 799 return PJSIP_EPARTIALMSG; … … 790 804 791 805 /* Find "Content-Length" header the hard way. */ 792 line = pj_ ansi_strchr(buf, '\n');806 line = pj_strchr(&cur_msg, '\n'); 793 807 while (line && line < hdr_end) { 794 808 ++line; … … 841 855 842 856 /* Go to next line. */ 843 line = pj_ansi_strchr(line, '\n'); 857 cur_msg.slen -= (line - cur_msg.ptr); 858 cur_msg.ptr = (char*)line; 859 line = pj_strchr(&cur_msg, '\n'); 844 860 } 845 861 … … 1653 1669 1654 1670 pj_scan_get( scanner, &pconst.pjsip_NOT_NEWLINE, &hdr->hvalue); 1655 if ( IS_NEWLINE(*scanner->curptr))1671 if (pj_scan_is_eof(scanner) || IS_NEWLINE(*scanner->curptr)) 1656 1672 break; 1657 1673 /* mangled, get next fraction */ … … 1983 1999 // &pconst.pjsip_TOKEN_SPEC, 1984 2000 // &pconst.pjsip_TOKEN_SPEC_ESC, 0); 1985 int_parse_param(scanner, pool, &pname, &pvalue, 0); 2001 //int_parse_param(scanner, pool, &pname, &pvalue, 0); 2002 // This should be the correct one: 2003 // added special spec for Via parameter, basically token plus 2004 // ":" to allow IPv6 address in the received param. 2005 pj_scan_get_char(scanner); 2006 parse_param_imp(scanner, pool, &pname, &pvalue, 2007 &pconst.pjsip_VIA_PARAM_SPEC, 2008 &pconst.pjsip_VIA_PARAM_SPEC_ESC, 2009 0); 1986 2010 1987 2011 if (!parser_stricmp(pname, pconst.pjsip_BRANCH_STR) && pvalue.slen) {
Note: See TracChangeset
for help on using the changeset viewer.