projects
/
metaproxy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Happy new year
[metaproxy-moved-to-github.git]
/
src
/
filter_http_client.cpp
diff --git
a/src/filter_http_client.cpp
b/src/filter_http_client.cpp
index
6cb9633
..
e756ce5
100644
(file)
--- a/
src/filter_http_client.cpp
+++ b/
src/filter_http_client.cpp
@@
-1,5
+1,5
@@
/* This file is part of Metaproxy.
/* This file is part of Metaproxy.
- Copyright (C) 2005-2013 Index Data
+ Copyright (C) Index Data
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Metaproxy is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
@@
-50,10
+50,17
@@
namespace metaproxy_1 {
void proxy(mp::Package &package);
std::string proxy_host;
std::string default_host;
void proxy(mp::Package &package);
std::string proxy_host;
std::string default_host;
+ int max_redirects;
+ Rep();
};
}
}
};
}
}
+yf::HTTPClient::Rep::Rep()
+{
+ max_redirects = -0;
+}
+
yf::HTTPClient::HTTPClient() : m_p(new Rep)
{
}
yf::HTTPClient::HTTPClient() : m_p(new Rep)
{
}
@@
-80,6
+87,8
@@
void yf::HTTPClient::Rep::proxy(mp::Package &package)
if (*http_proxy)
yaz_url_set_proxy(yaz_url, http_proxy);
if (*http_proxy)
yaz_url_set_proxy(yaz_url, http_proxy);
+ yaz_url_set_max_redirects(yaz_url, max_redirects);
+
std::string uri;
if (hreq->path[0] == '/')
{
std::string uri;
if (hreq->path[0] == '/')
{
@@
-102,7
+111,10
@@
void yf::HTTPClient::Rep::proxy(mp::Package &package)
}
else
{
}
else
{
- res_gdu = o.create_HTTP_Response(package.session(), hreq, 404);
+ res_gdu = o.create_HTTP_Response_details(
+ package.session(),
+ hreq, 502,
+ yaz_url_get_error(yaz_url));
}
package.response() = res_gdu;
yaz_url_destroy(yaz_url);
}
package.response() = res_gdu;
yaz_url_destroy(yaz_url);
@@
-131,6
+143,10
@@
void mp::filter::HTTPClient::configure(const xmlNode * ptr, bool test_only,
{
m_p->proxy_host = mp::xml::get_text(ptr);
}
{
m_p->proxy_host = mp::xml::get_text(ptr);
}
+ else if (!strcmp((const char *) ptr->name, "max-redirects"))
+ {
+ m_p->max_redirects = mp::xml::get_int(ptr, 0);
+ }
else if (!strcmp((const char *) ptr->name, "default-host"))
{
m_p->default_host = mp::xml::get_text(ptr);
else if (!strcmp((const char *) ptr->name, "default-host"))
{
m_p->default_host = mp::xml::get_text(ptr);