Ignore:
Timestamp:
Mar 18, 2009 6:24:40 PM (15 years ago)
Author:
bennylp
Message:

More ticket #747: the previous fix in r2505 causes parsing IPv6 address in Via to fail. Also added some torture messages in the SIP message test vectors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/test-pjsip/msg_test.c

    r2433 r2522  
    7474    "\r\n", 
    7575    &create_msg0, 
     76    0, 
    7677    PJ_SUCCESS 
    7778}, 
     
    101102    "a=rtpmap:0 PCMU/8000\r\n", 
    102103    &create_msg1, 
     104    0, 
     105    PJ_SUCCESS 
     106}, 
     107{ 
     108    /* Torture message from RFC 4475 
     109     * 3.1.1.1 A short tortuous INVITE 
     110     */ 
     111    "INVITE sip:vivekg@chair-dnrc.example.com;unknownparam SIP/2.0\n" 
     112    "TO :\n" 
     113    " sip:vivekg@chair-dnrc.example.com ;   tag    = 1918181833n\n" 
     114    "from   : \"J Rosenberg \\\\\\\"\"       <sip:jdrosen@example.com>\n" 
     115    "  ;\n" 
     116    "  tag = 98asjd8\n" 
     117    "MaX-fOrWaRdS: 0068\n" 
     118    "Call-ID: wsinv.ndaksdj@192.0.2.1\n" 
     119    "Content-Length   : 150\n" 
     120    "cseq: 0009\n" 
     121    "  INVITE\n" 
     122    "Via  : SIP  /   2.0\n" 
     123    " /UDP\n" 
     124    "    192.0.2.2;rport;branch=390skdjuw\n" 
     125    "s :\n" 
     126    "NewFangledHeader:   newfangled value\n" 
     127    " continued newfangled value\n" 
     128    "UnknownHeaderWithUnusualValue: ;;,,;;,;\n" 
     129    "Content-Type: application/sdp\n" 
     130    "Route:\n" 
     131    " <sip:services.example.com;lr;unknownwith=value;unknown-no-value>\n" 
     132    "v:  SIP  / 2.0  / TCP     spindle.example.com   ;\n" 
     133    "  branch  =   z9hG4bK9ikj8  ,\n" 
     134    " SIP  /    2.0   / UDP  192.168.255.111   ; branch=\n" 
     135    " z9hG4bK30239\n" 
     136    "m:\"Quoted string \\\"\\\"\" <sip:jdrosen@example.com> ; newparam =\n" 
     137    "      newvalue ;\n" 
     138    "  secondparam ; q = 0.33\r\n" 
     139    "\r\n" 
     140    "v=0\r\n" 
     141    "o=mhandley 29739 7272939 IN IP4 192.0.2.3\r\n" 
     142    "s=-\r\n" 
     143    "c=IN IP4 192.0.2.4\r\n" 
     144    "t=0 0\r\n" 
     145    "m=audio 49217 RTP/AVP 0 12\r\n" 
     146    "m=video 3227 RTP/AVP 31\r\n" 
     147    "a=rtpmap:31 LPC\r\n", 
     148    NULL, 
     149    0, 
     150    PJ_SUCCESS 
     151}, 
     152{ 
     153    /* Torture message from RFC 4475 
     154     * 3.1.1.2 Wide Range of Valid Characters 
     155     */ 
     156    "!interesting-Method0123456789_*+`.%indeed'~ sip:1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*:&it+has=1,weird!*pas$wo~d_too.(doesn't-it)@example.com SIP/2.0\n" 
     157    "Via: SIP/2.0/UDP host1.example.com;rport;branch=z9hG4bK-.!%66*_+`'~\n" 
     158    "To: \"BEL:\\\x07 NUL:\\\x00 DEL:\\\x7F\" <sip:1_unusual.URI~(to-be!sure)&isn't+it$/crazy?,/;;*@example.com>\n" 
     159    "From: token1~` token2'+_ token3*%!.- <sip:mundane@example.com> ;fromParam''~+*_!.-%=\"\xD1\x80\xD0\xB0\xD0\xB1\xD0\xBE\xD1\x82\xD0\xB0\xD1\x8E\xD1\x89\xD0\xB8\xD0\xB9\";tag=_token~1'+`*%!-.\n" 
     160    "Call-ID: intmeth.word%ZK-!.*_+'@word`~)(><:\\/\"][?}{\n" 
     161    "CSeq: 139122385 !interesting-Method0123456789_*+`.%indeed'~\n" 
     162    "Max-Forwards: 255\n" 
     163    "extensionHeader-!.%*+_`'~: \xEF\xBB\xBF\xE5\xA4\xA7\xE5\x81\x9C\xE9\x9B\xBB\n" 
     164    "Content-Length: 0\r\n\r\n", 
     165    NULL, 
     166    641, 
     167    PJ_SUCCESS 
     168}, 
     169{ 
     170    /* Torture message from RFC 4475 
     171     * 3.1.1.3 Valid Use of the % Escaping Mechanism 
     172     */ 
     173    "INVITE sip:sips%3Auser%40example.com@example.net SIP/2.0\n" 
     174    "To: sip:%75se%72@example.com\n" 
     175    "From: <sip:I%20have%20spaces@example.net>;tag=1234\n" 
     176    "Max-Forwards: 87\n" 
     177    "i: esc01.239409asdfakjkn23onasd0-3234\n" 
     178    "CSeq: 234234 INVITE\n" 
     179    "Via: SIP/2.0/UDP host5.example.net;rport;branch=z9hG4bKkdjuw\n" 
     180    "C: application/sdp\n" 
     181    "Contact:\n" 
     182    "  <sip:cal%6Cer@192.168.0.2:5060;%6C%72;n%61me=v%61lue%25%34%31>\n" 
     183    "Content-Length: 150\r\n" 
     184    "\r\n" 
     185    "v=0\r\n" 
     186    "o=mhandley 29739 7272939 IN IP4 192.0.2.1\r\n" 
     187    "s=-\r\n" 
     188    "c=IN IP4 192.0.2.1\r\n" 
     189    "t=0 0\r\n" 
     190    "m=audio 49217 RTP/AVP 0 12\r\n" 
     191    "m=video 3227 RTP/AVP 31\r\n" 
     192    "a=rtpmap:31 LPC\r\n", 
     193    NULL, 
     194    0, 
     195    PJ_SUCCESS 
     196}, 
     197{ 
     198    /* Torture message from RFC 4475 
     199     * 3.1.1.4 Escaped Nulls in URIs 
     200     */ 
     201    "REGISTER sip:example.com SIP/2.0\r\n" 
     202    "To: sip:null-%00-null@example.com\r\n" 
     203    "From: sip:null-%00-null@example.com;tag=839923423\r\n" 
     204    "Max-Forwards: 70\r\n" 
     205    "Call-ID: escnull.39203ndfvkjdasfkq3w4otrq0adsfdfnavd\r\n" 
     206    "CSeq: 14398234 REGISTER\r\n" 
     207    "Via: SIP/2.0/UDP host5.example.com;rport;branch=z9hG4bKkdjuw\r\n" 
     208    "Contact: <sip:%00@host5.example.com>\r\n" 
     209    "Contact: <sip:%00%00@host5.example.com>\r\n" 
     210    "L:0\r\n" 
     211    "\r\n", 
     212    NULL, 
     213    0, 
     214    PJ_SUCCESS 
     215}, 
     216{ 
     217    /* Torture message from RFC 4475 
     218     * 3.1.1.5 Use of % When It Is Not an Escape 
     219     */ 
     220    "RE%47IST%45R sip:registrar.example.com SIP/2.0\r\n" 
     221    "To: \"%Z%45\" <sip:resource@example.com>\r\n" 
     222    "From: \"%Z%45\" <sip:resource@example.com>;tag=f232jadfj23\r\n" 
     223    "Call-ID: esc02.asdfnqwo34rq23i34jrjasdcnl23nrlknsdf\r\n" 
     224    "Via: SIP/2.0/TCP host.example.com;rport;branch=z9hG4bK209%fzsnel234\r\n" 
     225    "CSeq: 29344 RE%47IST%45R\r\n" 
     226    "Max-Forwards: 70\r\n" 
     227    "Contact: <sip:alias1@host1.example.com>\r\n" 
     228    "C%6Fntact: <sip:alias2@host2.example.com>\r\n" 
     229    "Contact: <sip:alias3@host3.example.com>\r\n" 
     230    "l: 0\r\n" 
     231    "\r\n", 
     232    NULL, 
     233    0, 
    103234    PJ_SUCCESS 
    104235} 
     
    127258    enum { BUFLEN = 512 }; 
    128259 
    129     entry->len = pj_ansi_strlen(entry->msg); 
     260    if (entry->len==0) 
     261        entry->len = pj_ansi_strlen(entry->msg); 
    130262 
    131263    if (var.flag & FLAG_PARSE_ONLY) 
     
    181313    pj_add_timestamp(&var.parse_time, &t2); 
    182314 
    183     if (var.flag & FLAG_PARSE_ONLY) 
     315    if ((var.flag & FLAG_PARSE_ONLY) || entry->creator==NULL) 
    184316        return PJ_SUCCESS; 
    185317 
Note: See TracChangeset for help on using the changeset viewer.