- if (proxy_host.length())
- yaz_url_set_proxy(yaz_url, proxy_host.c_str());
- Z_HTTP_Response *http_response =
- yaz_url_exec(yaz_url, hreq->path, hreq->method,
+ yaz_url_set_max_redirects(yaz_url, max_redirects);
+
+ if (x_forwarded_for)
+ {
+ std::string peer_name2 = package.origin().get_address();
+ const char *peer_name1 =
+ z_HTTP_header_lookup(hreq->headers, "X-Forwarded-For");
+ std::string pcomb;
+ if (peer_name1)
+ {
+ pcomb.append(peer_name1);
+ pcomb.append(", ");
+ }
+ pcomb.append(peer_name2);
+ z_HTTP_header_set(o, &hreq->headers, "X-Forwarded-For",
+ pcomb.c_str());
+ }
+ std::string uri;
+ if (hreq->path[0] == '/')
+ {
+ if (default_host.length())
+ uri = default_host + hreq->path;
+ }
+ else
+ uri = hreq->path;
+ Z_HTTP_Response *http_response = 0;
+ if (uri.length())
+ http_response =
+ yaz_url_exec(yaz_url, uri.c_str(), hreq->method,