diff options
author | Benny Prijono <bennylp@teluu.com> | 2010-02-24 11:22:21 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2010-02-24 11:22:21 +0000 |
commit | 3f7f93bcd1e11620b65204288bb50ae9c4a8a759 (patch) | |
tree | 07da86b9f1fffee549c0a17db61b9f61463ad20e /pjsip | |
parent | 8ce4d5c170a037d490c8e8c75e4cdf0061052a02 (diff) |
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)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3108 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsip-simple/publishc.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pjsip/src/pjsip-simple/publishc.c b/pjsip/src/pjsip-simple/publishc.c index 6313ba96..15040619 100644 --- a/pjsip/src/pjsip-simple/publishc.c +++ b/pjsip/src/pjsip-simple/publishc.c @@ -661,6 +661,30 @@ static void tsx_callback(void *token, pjsip_event *event) while (!pj_list_empty(&pubc->pending_reqs)) { pjsip_tx_data *tdata = pubc->pending_reqs.next; pj_list_erase(tdata); + + /* Add SIP-If-Match if we have etag and the request doesn't have + * one (http://trac.pjsip.org/repos/ticket/996) + */ + if (pubc->etag.slen) { + const pj_str_t STR_HNAME = { "SIP-If-Match", 12 }; + pjsip_generic_string_hdr *sim_hdr; + + sim_hdr = (pjsip_generic_string_hdr*) + pjsip_msg_find_hdr_by_name(tdata->msg, &STR_HNAME, NULL); + if (!sim_hdr) { + /* Create the header */ + sim_hdr = pjsip_generic_string_hdr_create(tdata->pool, + &STR_HNAME, + &pubc->etag); + pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)sim_hdr); + + } else { + /* Update */ + if (pj_strcmp(&pubc->etag, &sim_hdr->hvalue)) + pj_strdup(tdata->pool, &sim_hdr->hvalue, &pubc->etag); + } + } + status = pjsip_publishc_send(pubc, tdata); if (status == PJ_EPENDING) { pj_assert(!"Not expected"); |