From 0ee1fd4b16bd7c5510c756790e8e4f1d2217de31 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 18 Apr 2012 10:13:37 +0200 Subject: [PATCH 1/1] zoom: more configurable format for contentProxy@server The proxy attribute of contentProxy element may include a %s magic, which will be substituted by the session ID. For example server="proxy.indexdata.com/%s" --- src/filter_zoom.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/filter_zoom.cpp b/src/filter_zoom.cpp index bf6f4ab..ae29e0d 100644 --- a/src/filter_zoom.cpp +++ b/src/filter_zoom.cpp @@ -1411,9 +1411,24 @@ Z_Records *yf::Zoom::Frontend::get_records(Package &package, if (b->enable_cproxy && b->content_session_id.length()) { - wrbuf_printf(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"); + + 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] = wrbuf_cstr(cproxy_host); xsl_parms[2] = 0; -- 1.7.10.4