1170
1171
LM_ERR("could not fetch xcap document\n");
1177
ctype = &xcaps_str_appxml;
1178
if(xuri.type==RESOURCE_LIST)
1179
ctype = &xcaps_str_apprlxml;
1180
else if(xuri.type==PRES_RULES)
1181
ctype = &xcaps_str_appapxml;
1182
else if(xuri.type==RLS_SERVICE)
1183
ctype = &xcaps_str_apprsxml;
1184
else if(xuri.type==USER_PROFILE)
1185
ctype = &xcaps_str_appupxml;
1186
else if(xuri.type==PRES_CONTENT)
1187
ctype = &xcaps_str_apppcxml;
1188
else if(xuri.type==PIDF_MANIPULATION)
1189
ctype = &xcaps_str_apppdxml;
1190
xcaps_send_reply(msg, 200, &xcaps_str_ok, &etag,
1193
1176
/* doc not found */
1194
1177
xcaps_send_reply(msg, 404, &xcaps_str_notfound, NULL,
1182
if(xuri.nss!=NULL && xuri.node.len>0)
1184
if((new_body.s = pkg_malloc(body.len))==NULL)
1186
LM_ERR("allocating package memory\n");
1189
new_body.len = body.len;
1191
if(xcaps_xpath_hack(&body, 0)<0)
1193
LM_ERR("could not hack xcap document\n");
1196
if(xcaps_xpath_get(&body, &xuri.node, &new_body)<0)
1198
LM_ERR("could not retrieve element from xcap document\n");
1203
/* element not found */
1204
xcaps_send_reply(msg, 404, &xcaps_str_notfound, NULL,
1206
pkg_free(new_body.s);
1210
if(xcaps_xpath_hack(&new_body, 1)<0)
1212
LM_ERR("could not hack xcap document\n");
1215
memcpy(body.s, new_body.s, new_body.len);
1216
body.len = new_body.len;
1217
pkg_free(new_body.s);
1221
/* doc or element found */
1222
ctype = &xcaps_str_appxml;
1223
if(xuri.type==RESOURCE_LIST)
1224
ctype = &xcaps_str_apprlxml;
1225
else if(xuri.type==PRES_RULES)
1226
ctype = &xcaps_str_appapxml;
1227
else if(xuri.type==RLS_SERVICE)
1228
ctype = &xcaps_str_apprsxml;
1229
else if(xuri.type==USER_PROFILE)
1230
ctype = &xcaps_str_appupxml;
1231
else if(xuri.type==PRES_CONTENT)
1232
ctype = &xcaps_str_apppcxml;
1233
else if(xuri.type==PIDF_MANIPULATION)
1234
ctype = &xcaps_str_apppdxml;
1235
xcaps_send_reply(msg, 200, &xcaps_str_ok, &etag,