MCPcopy Create free account
hub / github.com/apache/trafficserver / loadhtml

Method loadhtml

plugins/experimental/maxmind_acl/mmdb.cc:435–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

433}
434
435void
436Acl::loadhtml(const YAML::Node &htmlNode)
437{
438 std::string htmlname, htmlloc;
439 std::ifstream f;
440
441 if (!htmlNode) {
442 Dbg(dbg_ctl, "No html field set");
443 return;
444 }
445
446 if (htmlNode.IsNull()) {
447 Dbg(dbg_ctl, "Html field not set");
448 return;
449 }
450
451 htmlname = htmlNode.as<std::string>();
452 if (htmlname[0] != '/') {
453 htmlloc = TSConfigDirGet();
454 htmlloc += "/";
455 htmlloc.append(htmlname);
456 } else {
457 htmlloc.assign(htmlname);
458 }
459
460 f.open(htmlloc, std::ios::in);
461 if (f.is_open()) {
462 _html.append(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>());
463 f.close();
464 Dbg(dbg_ctl, "Loaded HTML from %s", htmlloc.c_str());
465 } else {
466 TSError("[%s] Unable to open HTML file %s", PLUGIN_NAME, htmlloc.c_str());
467 }
468}
469///////////////////////////////////////////////////////////////////////////////
470// Load the maxmind database from the config parameter
471bool

Callers

nothing calls this directly

Calls 8

TSConfigDirGetFunction · 0.85
TSErrorFunction · 0.50
appendMethod · 0.45
assignMethod · 0.45
openMethod · 0.45
is_openMethod · 0.45
closeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected