Changeset 5280 for pjproject


Ignore:
Timestamp:
Apr 20, 2016 1:58:15 AM (8 years ago)
Author:
ming
Message:

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.

Location:
pjproject/trunk/pjsip/src
Files:
2 edited

Legend:

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

    r5275 r5280  
    11501150                    pvalue->slen -= 2; 
    11511151                } 
    1152             } else if (*scanner->curptr == '[') { 
     1152            // } else if (*scanner->curptr == '[') { 
    11531153                /* pvalue can be a quoted IPv6; in this case, the 
    11541154                 * '[' and ']' quote characters are to be removed 
    1155                  * from the pvalue.  
     1155                 * from the pvalue. 
     1156                 * 
     1157                 * Update: this seems to be unnecessary and may cause 
     1158                 * parsing error for cases such as IPv6 reference with 
     1159                 * port number. 
    11561160                 */ 
    1157                 pj_scan_get_char(scanner); 
    1158                 pj_scan_get_until_ch(scanner, ']', pvalue); 
    1159                 pj_scan_get_char(scanner); 
     1161                // pj_scan_get_char(scanner); 
     1162                // pj_scan_get_until_ch(scanner, ']', pvalue); 
     1163                // pj_scan_get_char(scanner); 
    11601164            } else if(pj_cis_match(spec, *scanner->curptr)) { 
    11611165                parser_get_and_unescape(scanner, pool, spec, esc_spec, pvalue); 
  • pjproject/trunk/pjsip/src/test/uri_test.c

    r4728 r5280  
    723723    url->user = pj_str("user"); 
    724724    url->host = pj_str("::1"); 
    725     url->maddr_param = pj_str("::01"); 
     725    url->maddr_param = pj_str("[::01]"); 
    726726    return (pjsip_uri*)url; 
    727727} 
     
    733733    url = pjsip_sip_uri_create(pool, 0); 
    734734    url->host = pj_str("::1"); 
    735     url->maddr_param = pj_str("::01"); 
     735    url->maddr_param = pj_str("[::01]"); 
    736736    return (pjsip_uri*)url; 
    737737 
Note: See TracChangeset for help on using the changeset viewer.