Changeset 2651


Ignore:
Timestamp:
Apr 27, 2009 2:30:10 PM (15 years ago)
Author:
bennylp
Message:

Ticket #693: Allow incoming MESSAGE request without message body

  • also added SIPp scenario to test this
Location:
pjproject/trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_im.c

    r2394 r2651  
    128128        return PJ_FALSE; 
    129129    } 
    130 #else 
     130#elif 0 
    131131    pjsip_msg *msg; 
    132132 
     
    139139        return PJ_FALSE; 
    140140    } 
     141#else 
     142    /* Ticket #693: allow incoming MESSAGE without message body */ 
     143    PJ_UNUSED_ARG(rdata); 
     144    PJ_UNUSED_ARG(p_accept_hdr); 
    141145#endif 
    142146 
     
    155159    pjsip_msg_body *body = rdata->msg_info.msg->body; 
    156160 
     161#if 0 
     162    /* Ticket #693: allow incoming MESSAGE without message body */ 
    157163    /* Body MUST have been checked before */ 
    158164    pj_assert(body != NULL); 
     165#endif 
    159166 
    160167 
     
    173180    } 
    174181 
    175     if (pj_stricmp(&body->content_type.type, &STR_MIME_APP)==0 && 
     182    if (body && pj_stricmp(&body->content_type.type, &STR_MIME_APP)==0 && 
    176183        pj_stricmp(&body->content_type.subtype, &STR_MIME_ISCOMPOSING)==0) 
    177184    { 
     
    215222         
    216223        /* Save text body */ 
    217         text_body.ptr = (char*)rdata->msg_info.msg->body->data; 
    218         text_body.slen = rdata->msg_info.msg->body->len; 
    219  
    220         /* Get mime type */ 
    221         m = &rdata->msg_info.msg->body->content_type; 
    222         mime_type.ptr = buf; 
    223         mime_type.slen = pj_ansi_snprintf(buf, sizeof(buf), 
    224                                           "%.*s/%.*s", 
    225                                           (int)m->type.slen, 
    226                                           m->type.ptr, 
    227                                           (int)m->subtype.slen, 
    228                                           m->subtype.ptr); 
    229         if (mime_type.slen < 1) 
    230             mime_type.slen = 0; 
     224        if (body) { 
     225            text_body.ptr = (char*)rdata->msg_info.msg->body->data; 
     226            text_body.slen = rdata->msg_info.msg->body->len; 
     227 
     228            /* Get mime type */ 
     229            m = &rdata->msg_info.msg->body->content_type; 
     230            mime_type.ptr = buf; 
     231            mime_type.slen = pj_ansi_snprintf(buf, sizeof(buf), 
     232                                              "%.*s/%.*s", 
     233                                              (int)m->type.slen, 
     234                                              m->type.ptr, 
     235                                              (int)m->subtype.slen, 
     236                                              m->subtype.ptr); 
     237            if (mime_type.slen < 1) 
     238                mime_type.slen = 0; 
     239 
     240 
     241        } else { 
     242            text_body.ptr = mime_type.ptr = ""; 
     243            text_body.slen = mime_type.slen = 0; 
     244        } 
    231245 
    232246        if (pjsua_var.ua_cfg.cb.on_pager) { 
Note: See TracChangeset for help on using the changeset viewer.