Ignore:
Timestamp:
Jul 17, 2006 10:04:12 AM (18 years ago)
Author:
bennylp
Message:

Fixed bugs with the parsing (re: allowable chars): (1) Parameters in URI and header should have different spec. URI should use paramchar spec while header should use token spec (thanks Jeroen van Bemmel) (2) The same rule applies when escaping the parameters during printing process (3) While we're on it, also fixed the tel-URI parser to automatically unescape the parameter values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c

    r583 r606  
    5656static pj_cis_t pjsip_TEL_PNAME_SPEC; 
    5757static pj_cis_t pjsip_TEL_PVALUE_SPEC; 
     58static pj_cis_t pjsip_TEL_PVALUE_SPEC_ESC; 
    5859static pj_cis_t pjsip_TEL_PARSING_PVALUE_SPEC; 
     60static pj_cis_t pjsip_TEL_PARSING_PVALUE_SPEC_ESC; 
    5961 
    6062static pj_str_t pjsip_ISUB_STR = { "isub", 4 }; 
     
    153155    pj_cis_add_str(&pjsip_TEL_PVALUE_SPEC, PARAM_CHAR); 
    154156 
     157    status = pj_cis_dup(&pjsip_TEL_PVALUE_SPEC_ESC, &pjsip_TEL_PVALUE_SPEC); 
     158    pj_cis_del_str(&pjsip_TEL_PVALUE_SPEC_ESC, "%"); 
     159 
    155160    status = pj_cis_dup(&pjsip_TEL_PARSING_PVALUE_SPEC, &pjsip_TEL_URIC_SPEC); 
    156161    PJ_ASSERT_RETURN(status==PJ_SUCCESS, status); 
    157162    pj_cis_add_cis(&pjsip_TEL_PARSING_PVALUE_SPEC, &pjsip_TEL_PVALUE_SPEC); 
    158163    pj_cis_add_str(&pjsip_TEL_PARSING_PVALUE_SPEC, "="); 
     164 
     165    status = pj_cis_dup(&pjsip_TEL_PARSING_PVALUE_SPEC_ESC,  
     166                        &pjsip_TEL_PARSING_PVALUE_SPEC); 
     167    pj_cis_del_str(&pjsip_TEL_PVALUE_SPEC_ESC, "%"); 
    159168 
    160169    status = pjsip_register_uri_parser("tel", &tel_uri_parse); 
     
    394403            if (*scanner->curptr == '=') { 
    395404                pj_scan_get_char(scanner); 
    396                 pj_scan_get(scanner, &pjsip_TEL_PARSING_PVALUE_SPEC, &pvalue); 
     405 
     406#               if defined(PJSIP_UNESCAPE_IN_PLACE) && PJSIP_UNESCAPE_IN_PLACE!=0 
     407                    pj_scan_get_unescape( scanner,  
     408                                          &pjsip_TEL_PARSING_PVALUE_SPEC_ESC, 
     409                                          &pvalue); 
     410#               else 
     411                    pj_scan_get(scanner, &pjsip_TEL_PARSING_PVALUE_SPEC,  
     412                                &pvalue); 
     413                    *token = pj_str_unescape(pool, &pvalue); 
     414#               endif 
     415 
    397416            } else { 
    398417                pvalue.slen = 0; 
Note: See TracChangeset for help on using the changeset viewer.