X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ffilter_http_rewrite.cpp;h=249a7572bc89fc548775a29ed60545fc706dfb6c;hb=0ce322844494022dc85a9c776d9ff041aad17520;hp=ff1a25c9295c164298554a5334fa01cd9f87d3ac;hpb=1933e4904a95ec7c430b61a2dcc0e907cbac75de;p=metaproxy-moved-to-github.git diff --git a/src/filter_http_rewrite.cpp b/src/filter_http_rewrite.cpp index ff1a25c..249a757 100644 --- a/src/filter_http_rewrite.cpp +++ b/src/filter_http_rewrite.cpp @@ -200,22 +200,22 @@ const std::string yf::HttpRewrite::search_replace( = groups_bynum.find(i); if (it != groups_bynum.end()) { //it is - std::string name = it->second; if (!what[i].str().empty()) - vars[name] = what[i]; + vars[it->second] = what[i]; } } //prepare replacement string std::string rvalue = sub_vars(uri_pat, vars); - //rewrite value - std::string rhvalue = what.prefix().str() - + rvalue + what.suffix().str(); yaz_log(YLOG_LOG, "! Rewritten '%s' to '%s'", what.str(0).c_str(), rvalue.c_str()); - out += rhvalue; + out.append(start, what[0].first); + out.append(rvalue); start = what[0].second; //move search forward } + //if we had a match cat the last part + if (start != txt.begin()) + out.append(start, end); return out; }