X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_http_client.cpp;h=b8c20155f2ff7f89632b1d06f14fb0561941c246;hb=8b5b1897bd1223b6c8608685e0cceb82b47e5aed;hp=9e9512a4a6992db55c5c0d38228d10460e60d979;hpb=4af83af2939aae2ddf5d9fb018663c1cf0f424a1;p=metaproxy-moved-to-github.git diff --git a/src/filter_http_client.cpp b/src/filter_http_client.cpp index 9e9512a..b8c2015 100644 --- a/src/filter_http_client.cpp +++ b/src/filter_http_client.cpp @@ -52,6 +52,7 @@ namespace metaproxy_1 { std::string default_host; int max_redirects; bool x_forwarded_for; + bool bind_host; Rep(); }; } @@ -61,6 +62,7 @@ yf::HTTPClient::Rep::Rep() { max_redirects = 0; x_forwarded_for = false; + bind_host = false; } yf::HTTPClient::HTTPClient() : m_p(new Rep) @@ -114,6 +116,14 @@ void yf::HTTPClient::Rep::proxy(mp::Package &package) } else uri = hreq->path; + + + if (bind_host) + { + std::string host = package.origin().get_bind_address(); + uri.append(" "); + uri.append(host); + } Z_HTTP_Response *http_response = 0; if (uri.length()) http_response = @@ -178,6 +188,10 @@ void mp::filter::HTTPClient::configure(const xmlNode * ptr, bool test_only, { m_p->x_forwarded_for = mp::xml::get_bool(ptr, 0); } + else if (!strcmp((const char *) ptr->name, "bind_host")) + { + m_p->bind_host = mp::xml::get_bool(ptr, 0); + } else { throw mp::filter::FilterException