Changeset 3108


Ignore:
Timestamp:
Feb 24, 2010 11:22:21 AM (14 years ago)
Author:
bennylp
Message:

Ticket #996: update the ETag header in the pending PUBLISH requests if the value changes in the previous request (thanks Johan Lantz for the report)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-simple/publishc.c

    r2940 r3108  
    662662            pjsip_tx_data *tdata = pubc->pending_reqs.next; 
    663663            pj_list_erase(tdata); 
     664 
     665            /* Add SIP-If-Match if we have etag and the request doesn't have 
     666             * one (http://trac.pjsip.org/repos/ticket/996) 
     667             */ 
     668            if (pubc->etag.slen) { 
     669                const pj_str_t STR_HNAME = { "SIP-If-Match", 12 }; 
     670                pjsip_generic_string_hdr *sim_hdr; 
     671 
     672                sim_hdr = (pjsip_generic_string_hdr*) 
     673                          pjsip_msg_find_hdr_by_name(tdata->msg, &STR_HNAME, NULL); 
     674                if (!sim_hdr) { 
     675                    /* Create the header */ 
     676                    sim_hdr = pjsip_generic_string_hdr_create(tdata->pool, 
     677                                                              &STR_HNAME, 
     678                                                              &pubc->etag); 
     679                    pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)sim_hdr); 
     680 
     681                } else { 
     682                    /* Update */ 
     683                    if (pj_strcmp(&pubc->etag, &sim_hdr->hvalue)) 
     684                        pj_strdup(tdata->pool, &sim_hdr->hvalue, &pubc->etag); 
     685                } 
     686            } 
     687 
    664688            status = pjsip_publishc_send(pubc, tdata); 
    665689            if (status == PJ_EPENDING) { 
Note: See TracChangeset for help on using the changeset viewer.