| 1173 | } |
| 1174 | |
| 1175 | void |
| 1176 | Find_Stripe(swoc::file::path const &input_file_path) |
| 1177 | { |
| 1178 | // scheme=http user=u password=p host=172.28.56.109 path=somepath query=somequery port=1234 |
| 1179 | // input file format: scheme://hostname:port/somepath;params?somequery user=USER password=PASS |
| 1180 | // user, password, are optional; scheme and host are required |
| 1181 | |
| 1182 | // char* h= http://user:pass@IPADDRESS/path_to_file;?port <== this is the format we need |
| 1183 | // url_matcher matcher; |
| 1184 | // if (matcher.match(h)) |
| 1185 | // std::cout << h << " : is valid" << std::endl; |
| 1186 | // else |
| 1187 | // std::cout << h << " : is NOT valid" << std::endl; |
| 1188 | |
| 1189 | Cache cache; |
| 1190 | if (!input_file_path.empty()) { |
| 1191 | printf("passed argv %s\n", input_file_path.c_str()); |
| 1192 | } |
| 1193 | cache.loadURLs(input_file_path); |
| 1194 | if ((err = cache.loadSpan(SpanFile))) { |
| 1195 | cache.dumpSpans(Cache::SpanDumpDepth::SPAN); |
| 1196 | cache.build_stripe_hash_table(); |
| 1197 | for (auto host : cache.URLset) { |
| 1198 | CryptoContext ctx; |
| 1199 | CryptoHash hashT; |
| 1200 | swoc::LocalBufferWriter<33> w; |
| 1201 | ctx.update(host->url.data(), host->url.size()); |
| 1202 | ctx.update(&host->port, sizeof(host->port)); |
| 1203 | ctx.finalize(hashT); |
| 1204 | StripeSM *stripe_ = cache.key_to_stripe(&hashT, host->url.data(), host->url.size()); |
| 1205 | w.print("{}", hashT); |
| 1206 | printf("hash of %.*s is %.*s: Stripe %s \n", static_cast<int>(host->url.size()), host->url.data(), |
| 1207 | static_cast<int>(w.size()), w.data(), stripe_->hashText.data()); |
| 1208 | } |
| 1209 | } |
| 1210 | } |
| 1211 | |
| 1212 | void |
| 1213 | dir_check() |
no test coverage detected