- if (rec_buf && b->enable_cproxy)
- {
- xmlDoc *doc = xmlParseMemory(rec_buf, rec_len);
- std::string res =
- mp::xml::url_recipe_handle(doc, b->sptr->urlRecipe);
- if (res.length() && b->content_session_id.length())
- {
- size_t off = res.find_first_of("://");
- if (off != std::string::npos)
- {
- char tmp[1024];
- sprintf(tmp, "%s.%s/",
- b->content_session_id.c_str(),
- m_p->content_proxy_server.c_str());
- res.insert(off + 3, tmp);
- }
- }
- if (res.length())
- {
- xmlNode *ptr = xmlDocGetRootElement(doc);
- while (ptr && ptr->type != XML_ELEMENT_NODE)
- ptr = ptr->next;
- xmlNode *c =
- xmlNewChild(ptr, 0, BAD_CAST "metadata", 0);
- xmlNewProp(c, BAD_CAST "type", BAD_CAST
- "generated-url");
- xmlNode * t = xmlNewText(BAD_CAST res.c_str());
- xmlAddChild(c, t);
-
- if (xmlrec_buf)
- xmlFree(xmlrec_buf);
-
- xmlDocDumpMemory(doc, &xmlrec_buf, &rec_len);
- rec_buf = (const char *) xmlrec_buf;
- }
- xmlFreeDoc(doc);
- }