78 Z_GDU *req_gdu = package.request().get();
79 if (req_gdu && req_gdu->which == Z_GDU_HTTP_Request)
81 Z_HTTP_Request *hreq = req_gdu->u.HTTP_Request;
84 yaz_url_t yaz_url = yaz_url_create();
85 const char *http_proxy =
86 z_HTTP_header_remove(&hreq->headers,
"X-Metaproxy-Proxy");
92 yaz_url_set_proxy(yaz_url, http_proxy);
98 std::string peer_name2 = package.origin().get_address();
99 const char *peer_name1 =
100 z_HTTP_header_lookup(hreq->headers,
"X-Forwarded-For");
104 pcomb.append(peer_name1);
107 pcomb.append(peer_name2);
108 z_HTTP_header_set(o, &hreq->headers,
"X-Forwarded-For",
112 if (hreq->path[0] ==
'/')
122 std::string host = package.origin().get_bind_address();
128 res_gdu = o.create_HTTP_Response_details(
131 "http_client: no target URI specified");
135 Z_HTTP_Response * http_response =
136 yaz_url_exec(yaz_url, uri.c_str(), hreq->method,
137 hreq->headers, hreq->content_buf,
141 res_gdu = o.create_HTTP_Response(package.session(), hreq, 200);
142 z_HTTP_header_remove(&http_response->headers,
"Transfer-Encoding");
143 res_gdu->u.HTTP_Response = http_response;
147 res_gdu = o.create_HTTP_Response_details(
149 hreq, 502, yaz_url_get_error(yaz_url));
152 package.response() = res_gdu;
153 yaz_url_destroy(yaz_url);