Module: sip-router Branch: master Commit: 406f43b42f8d5ef015d4fd7b1e17158430be7b2e URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=406f43b4...
Author: root root@boyce.voipuser.org Committer: root root@boyce.voipuser.org Date: Tue Sep 21 13:09:42 2010 +0100
xcap_server: set content-type per auid in reply
- accept also xcap-caps auid
---
modules_k/xcap_server/xcap_misc.c | 4 ++++ modules_k/xcap_server/xcap_server.c | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/modules_k/xcap_server/xcap_misc.c b/modules_k/xcap_server/xcap_misc.c index 1c844e7..103d218 100644 --- a/modules_k/xcap_server/xcap_misc.c +++ b/modules_k/xcap_server/xcap_misc.c @@ -145,6 +145,10 @@ int xcap_parse_uri(str *huri, str *xroot, xcap_uri_t *xuri) LM_DBG("matched resource-lists\n"); xuri->type = RESOURCE_LIST; xuri->auid.len = 14; + } else if(s.len>10 && strncmp(s.s, "xcap-caps/", 10)==0) { + LM_DBG("matched xcap-caps\n"); + xuri->type = XCAP_CAPS; + xuri->auid.len = 9; } else { LM_ERR("unsupported auid in [%.*s]\n", xuri->uri.len, xuri->uri.s); diff --git a/modules_k/xcap_server/xcap_server.c b/modules_k/xcap_server/xcap_server.c index 4f5d5c0..d37c860 100644 --- a/modules_k/xcap_server/xcap_server.c +++ b/modules_k/xcap_server/xcap_server.c @@ -403,6 +403,13 @@ static str xcaps_str_ok = {"OK", 2}; static str xcaps_str_srverr = {"Server error", 12}; static str xcaps_str_nocontent = {"No content", 10}; static str xcaps_str_appxml = {"application/xml", 15}; +static str xcaps_str_apprlxml = {"application/resource-lists+xml", 30}; +static str xcaps_str_apprsxml = {"application/rls-services+xml", 28}; +#if 0 +static str xcaps_str_appxcxml = {"application/xcap-caps+xml", 25}; +#endif +static str xcaps_str_appapxml = {"application/auth-policy+xml", 27}; +
/** * @@ -721,6 +728,7 @@ static int w_xcaps_get(sip_msg_t* msg, char* puri, char* ppath) str body; int ret = 0; xcap_uri_t xuri; + str *ctype;
if(puri==0 || ppath==0) { @@ -771,11 +779,18 @@ static int w_xcaps_get(sip_msg_t* msg, char* puri, char* ppath) if(ret==0) { /* doc found */ + ctype = &xcaps_str_appxml; + if(xuri.type==RESOURCE_LIST) + ctype = &xcaps_str_apprlxml; + else if(xuri.type==PRES_RULES) + ctype = &xcaps_str_appapxml; + else if(xuri.type==RLS_SERVICE) + ctype = &xcaps_str_apprsxml; xcaps_send_reply(msg, 200, &xcaps_str_ok, &etag, - &xcaps_str_appxml, &body); + ctype, &body); } else { /* doc not found */ - xcaps_send_reply(msg, 204, &xcaps_str_nocontent, &xcaps_str_empty, + xcaps_send_reply(msg, 200, &xcaps_str_nocontent, &xcaps_str_empty, &xcaps_str_empty, &xcaps_str_empty); } return 1;