| 433 | } |
| 434 | |
| 435 | void |
| 436 | Acl::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 |
| 471 | bool |