X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Ffilter_zoom.cpp;h=ae29e0d5f0fedc5b804645862b178aec4d8d8e8d;hb=0ee1fd4b16bd7c5510c756790e8e4f1d2217de31;hp=76eb388c6cd98fa117120f29a2f5f2725a43a4dc;hpb=dc0a7b40ef2cc8138c93e078dd8c34de64460ebe;p=metaproxy-moved-to-github.git diff --git a/src/filter_zoom.cpp b/src/filter_zoom.cpp index 76eb388..ae29e0d 100644 --- a/src/filter_zoom.cpp +++ b/src/filter_zoom.cpp @@ -1407,28 +1407,35 @@ Z_Records *yf::Zoom::Frontend::get_records(Package &package, { // only return records if no error and at least one record const char *xsl_parms[3]; - char cproxy_host[1024]; - + mp::wrbuf cproxy_host; + if (b->enable_cproxy && b->content_session_id.length()) { - sprintf(cproxy_host, "%s.%s/", - b->content_session_id.c_str(), - m_p->content_proxy_server.c_str()); + const char *proxy_server_cstr = m_p->content_proxy_server.c_str(); + const char *session_sub = strstr(proxy_server_cstr, "%s"); - char *q_cproxy_host = (char *) - odr_malloc(odr, strlen(cproxy_host) + 3); - strcpy(q_cproxy_host, "\""); - strcat(q_cproxy_host, cproxy_host); - strcat(q_cproxy_host, "\""); - + if (session_sub) + { + wrbuf_puts(cproxy_host, "\""); + wrbuf_write(cproxy_host, proxy_server_cstr, + session_sub - proxy_server_cstr); + wrbuf_puts(cproxy_host, b->content_session_id.c_str()); + wrbuf_puts(cproxy_host, session_sub + 2); + wrbuf_puts(cproxy_host, "/\""); + } + else + { + wrbuf_printf(cproxy_host, "\"%s.%s/\"", + b->content_session_id.c_str(), + proxy_server_cstr); + } xsl_parms[0] = "cproxyhost"; - xsl_parms[1] = q_cproxy_host; + xsl_parms[1] = wrbuf_cstr(cproxy_host); xsl_parms[2] = 0; } else { xsl_parms[0] = 0; - *cproxy_host = '\0'; } char *odr_database = odr_strdup(odr, @@ -1545,7 +1552,6 @@ Z_Records *yf::Zoom::Frontend::get_records(Package &package, xsltSaveResultToString(&xmlrec_buf, &rec_len, rec_res, xsp); rec_buf = (const char *) xmlrec_buf; - package.log("zoom", YLOG_LOG, "xslt successful"); package.log_write(rec_buf, rec_len); xmlFreeDoc(rec_res);