X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ffilter_sru_to_z3950.cpp;h=26a6ad2d009cafa99648fbf7b6f59a7f1709436a;hb=5cb1f9609e107e4ba58e0d2726a28e0a3fe33135;hp=fa12345d9aeb620c00d12e5e56c57de07bed8f37;hpb=36124975217061b8fb61e5bafb18accee24dba53;p=metaproxy-moved-to-github.git diff --git a/src/filter_sru_to_z3950.cpp b/src/filter_sru_to_z3950.cpp index fa12345..26a6ad2 100644 --- a/src/filter_sru_to_z3950.cpp +++ b/src/filter_sru_to_z3950.cpp @@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include #if YAZ_VERSIONL >= 0x50000 #include #endif @@ -518,6 +519,19 @@ yf::SRUtoZ3950::Impl::z3950_init_request(mp::Package &package, mp_util::set_vhost_otherinfo(&init_req->otherInfo, odr_en, host, 1); } + Z_GDU *zgdu_req = package.request().get(); + if (zgdu_req->which == Z_GDU_HTTP_Request) + { + Z_HTTP_Request *hreq = zgdu_req->u.HTTP_Request; + const char *peer_name = + z_HTTP_header_lookup(hreq->headers, "X-Forwarded-For"); + if (peer_name) + { + yaz_oi_set_string_oid(&init_req->otherInfo, odr_en, + yaz_oid_userinfo_client_ip, 1, peer_name); + } + } + z3950_package.request() = apdu; // send Z3950 package