metaproxy  1.21.0
Classes | Public Member Functions | Private Attributes | List of all members
metaproxy_1::filter::HTTPClient Class Reference

#include <filter_http_client.hpp>

Inheritance diagram for metaproxy_1::filter::HTTPClient:
Inheritance graph
Collaboration diagram for metaproxy_1::filter::HTTPClient:
Collaboration graph

Classes

class  Rep
 

Public Member Functions

 ~HTTPClient ()
 
 HTTPClient ()
 
void process (metaproxy_1::Package &package) const
 
void configure (const xmlNode *ptr, bool test_only, const char *path)
 

Private Attributes

boost::scoped_ptr< Repm_p
 

Detailed Description

Definition at line 28 of file filter_http_client.hpp.

Constructor & Destructor Documentation

◆ ~HTTPClient()

mp::filter::HTTPClient::~HTTPClient ( )

Definition at line 72 of file filter_http_client.cpp.

73 {
74 }

◆ HTTPClient()

mp::filter::HTTPClient::HTTPClient ( )

Definition at line 68 of file filter_http_client.cpp.

68  : m_p(new Rep)
69 {
70 }

Member Function Documentation

◆ configure()

void mp::filter::HTTPClient::configure ( const xmlNode *  ptr,
bool  test_only,
const char *  path 
)

Definition at line 168 of file filter_http_client.cpp.

170 {
171  for (ptr = ptr->children; ptr; ptr = ptr->next)
172  {
173  if (ptr->type != XML_ELEMENT_NODE)
174  continue;
175  else if (!strcmp((const char *) ptr->name, "proxy"))
176  {
177  m_p->proxy_host = mp::xml::get_text(ptr);
178  }
179  else if (!strcmp((const char *) ptr->name, "max-redirects"))
180  {
181  m_p->max_redirects = mp::xml::get_int(ptr, 0);
182  }
183  else if (!strcmp((const char *) ptr->name, "default-host"))
184  {
185  m_p->default_host = mp::xml::get_text(ptr);
186  if (m_p->default_host.find("://") == std::string::npos)
187  {
188  throw mp::filter::FilterException
189  ("default-host is missing method (such as http://)"
190  " in http_client filter");
191  }
192  }
193  else if (!strcmp((const char *) ptr->name, "x-forwarded-for"))
194  {
195  m_p->x_forwarded_for = mp::xml::get_bool(ptr, 0);
196  }
197  else if (!strcmp((const char *) ptr->name, "bind_host"))
198  {
199  m_p->bind_host = mp::xml::get_bool(ptr, 0);
200  }
201  else
202  {
203  throw mp::filter::FilterException
204  ("Bad element "
205  + std::string((const char *) ptr->name)
206  + " in http_client filter");
207  }
208  }
209 }

◆ process()

void mp::filter::HTTPClient::process ( metaproxy_1::Package &  package) const

Definition at line 159 of file filter_http_client.cpp.

160 {
161  Z_GDU *gdu = package.request().get();
162  if (gdu && gdu->which == Z_GDU_HTTP_Request)
163  m_p->proxy(package);
164  else
165  package.move();
166 }

Member Data Documentation

◆ m_p

boost::scoped_ptr<Rep> metaproxy_1::filter::HTTPClient::m_p
private

Definition at line 38 of file filter_http_client.hpp.


The documentation for this class was generated from the following files: