| 342 | static bool getDefaultBucket(TSHttpTxn txnp, TSMBuffer bufp, TSMLoc hdr_obj, ClientRequest &creq); |
| 343 | |
| 344 | void |
| 345 | TSPluginInit(int argc, const char *argv[]) |
| 346 | { |
| 347 | TSPluginRegistrationInfo info; |
| 348 | info.plugin_name = "combo_handler"; |
| 349 | info.vendor_name = "Apache Software Foundation"; |
| 350 | info.support_email = "dev@trafficserver.apache.org"; |
| 351 | |
| 352 | if (TSPluginRegister(&info) != TS_SUCCESS) { |
| 353 | TSError("[combo_handler][%s] plugin registration failed", __FUNCTION__); |
| 354 | return; |
| 355 | } |
| 356 | |
| 357 | if (argc > 1) { |
| 358 | int c; |
| 359 | static const struct option longopts[] = { |
| 360 | {"max-files", required_argument, nullptr, 'f'}, |
| 361 | {nullptr, 0, nullptr, 0 }, |
| 362 | }; |
| 363 | |
| 364 | int longindex = 0; |
| 365 | optind = 1; // Force restart to avoid problems with other plugins. |
| 366 | while ((c = getopt_long(argc, const_cast<char *const *>(argv), "f:", longopts, &longindex)) != -1) { |
| 367 | switch (c) { |
| 368 | case 'f': { |
| 369 | char *tmp = nullptr; |
| 370 | long n = strtol(optarg, &tmp, 0); |
| 371 | if (tmp == optarg) { |
| 372 | TSError("[%s] %s requires a numeric argument", DEBUG_TAG, longopts[longindex].name); |
| 373 | } else if (n < 1) { |
| 374 | TSError("[%s] %s must be a positive number", DEBUG_TAG, longopts[longindex].name); |
| 375 | } else { |
| 376 | MaxFileCount = n; |
| 377 | Dbg(dbg_ctl, "Max files set to %u", MaxFileCount); |
| 378 | } |
| 379 | break; |
| 380 | } |
| 381 | default: |
| 382 | TSError("[%s] Unrecognized option '%s'", DEBUG_TAG, argv[optind - 1]); |
| 383 | break; |
| 384 | } |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | if (argc >= optind && (argv[optind][0] != '-' || argv[optind][1])) { |
| 389 | COMBO_HANDLER_PATH = argv[optind]; |
| 390 | if (COMBO_HANDLER_PATH == "/") { |
| 391 | COMBO_HANDLER_PATH.clear(); |
| 392 | } else { |
| 393 | if (COMBO_HANDLER_PATH[0] == '/') { |
| 394 | COMBO_HANDLER_PATH.erase(0, 1); |
| 395 | } |
| 396 | if (COMBO_HANDLER_PATH[COMBO_HANDLER_PATH.size() - 1] == '/') { |
| 397 | COMBO_HANDLER_PATH.erase(COMBO_HANDLER_PATH.size() - 1, 1); |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | ++optind; |
nothing calls this directly
no test coverage detected