| 552 | } |
| 553 | |
| 554 | Errata |
| 555 | Cache::loadURLs(swoc::file::path const &path) |
| 556 | { |
| 557 | static const swoc::TextView TAG_VOL("url"); |
| 558 | ts::URLparser loadURLparser; |
| 559 | Errata zret; |
| 560 | |
| 561 | std::error_code ec; |
| 562 | std::string load_content = swoc::file::load(path, ec); |
| 563 | if (ec.value() == 0) { |
| 564 | swoc::TextView content(load_content); |
| 565 | while (!content.empty()) { |
| 566 | swoc::TextView blob = content.take_prefix_at('\n'); |
| 567 | |
| 568 | swoc::TextView tag(blob.take_prefix_at('=')); |
| 569 | if (tag.empty()) { |
| 570 | } else if (0 == strcasecmp(tag, TAG_VOL)) { |
| 571 | std::string url; |
| 572 | url.assign(blob.data(), blob.size()); |
| 573 | int port_ptr = -1, port_len = -1; |
| 574 | int port = loadURLparser.getPort(url, port_ptr, port_len); |
| 575 | if (port_ptr >= 0 && port_len > 0) { |
| 576 | url.erase(port_ptr, port_len + 1); // get rid of :PORT |
| 577 | } |
| 578 | std::cout << "port # " << port << ":" << port_ptr << ":" << port_len << ":" << url << std::endl; |
| 579 | ts::CacheURL *curl = new ts::CacheURL(url, port); |
| 580 | URLset.emplace(curl); |
| 581 | } |
| 582 | } |
| 583 | } else { |
| 584 | zret = Errata(make_errno_code(EBADF), "Unable to load ", path.string()); |
| 585 | } |
| 586 | return zret; |
| 587 | } |
| 588 | |
| 589 | void |
| 590 | Cache::dumpSpans(SpanDumpDepth depth) |
no test coverage detected