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

#include <filter_http_file.hpp>

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

Classes

struct  Area
 
class  Mime
 
class  Rep
 

Public Member Functions

 HttpFile ()
 
 ~HttpFile ()
 
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_file.hpp.

Constructor & Destructor Documentation

metaproxy_1::filter::HttpFile::HttpFile ( )
metaproxy_1::filter::HttpFile::~HttpFile ( )

Member Function Documentation

void metaproxy_1::filter::HttpFile::configure ( const xmlNode *  ptr,
bool  test_only,
const char *  path 
)

Definition at line 283 of file filter_http_file.cpp.

References metaproxy_1::filter::HttpFile::Area::m_file_root, m_p, metaproxy_1::filter::HttpFile::Area::m_passthru, metaproxy_1::filter::HttpFile::Area::m_raw, and metaproxy_1::filter::HttpFile::Area::m_url_path_prefix.

285 {
286  for (ptr = ptr->children; ptr; ptr = ptr->next)
287  {
288  if (ptr->type != XML_ELEMENT_NODE)
289  continue;
290  if (!strcmp((const char *) ptr->name, "mimetypes"))
291  {
292  std::string fname = mp::xml::get_text(ptr);
293 
294  mp::PlainFile f;
295 
296  if (!f.open(fname))
297  {
298  throw mp::filter::FilterException
299  ("Can not open mime types file " + fname);
300  }
301 
302  std::vector<std::string> args;
303  while (f.getline(args))
304  {
305  size_t i;
306  for (i = 1; i<args.size(); i++)
307  m_p->m_ext_to_map[args[i]] = args[0];
308  }
309  }
310  else if (!strcmp((const char *) ptr->name, "area"))
311  {
312  xmlNode *a_node = ptr->children;
313  Area a;
314 
315  for (; a_node; a_node = a_node->next)
316  {
317  if (a_node->type != XML_ELEMENT_NODE)
318  continue;
319 
320  if (mp::xml::is_element_mp(a_node, "documentroot"))
321  a.m_file_root = mp::xml::get_text(a_node);
322  else if (mp::xml::is_element_mp(a_node, "prefix"))
323  a.m_url_path_prefix = mp::xml::get_text(a_node);
324  else if (mp::xml::is_element_mp(a_node, "raw"))
325  a.m_raw = mp::xml::get_bool(a_node, false);
326  else if (mp::xml::is_element_mp(a_node, "passthru"))
327  a.m_passthru = mp::xml::get_bool(a_node, false);
328  else
329  throw mp::filter::FilterException
330  ("Bad element "
331  + std::string((const char *) a_node->name)
332  + " in area section"
333  );
334  }
335  if (a.m_file_root.length())
336  {
337  m_p->m_area_list.push_back(a);
338  }
339  }
340  else
341  {
342  throw mp::filter::FilterException
343  ("Bad element "
344  + std::string((const char *) ptr->name)
345  + " in virt_db filter");
346  }
347  }
348 }
boost::scoped_ptr< Rep > m_p
void metaproxy_1::filter::HttpFile::process ( metaproxy_1::Package &  package) const

Member Data Documentation

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

Definition at line 31 of file filter_http_file.hpp.

Referenced by configure().


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