////////////////////////////////////////////////////////////////////////// We don't have any specific "instances" here, at least not yet.
| 185 | // We don't have any specific "instances" here, at least not yet. |
| 186 | // |
| 187 | TSReturnCode |
| 188 | TSRemapNewInstance(int argc, char **argv, void **ih, char * /* errbuf ATS_UNUSED */, int /* errbuf_size ATS_UNUSED */) |
| 189 | { |
| 190 | TSCont cont = TSContCreate(cont_handle_cache, nullptr); |
| 191 | BgFetchConfig *config = new BgFetchConfig(cont); |
| 192 | bool success = true; |
| 193 | |
| 194 | // The first two arguments are the "from" and "to" URL string. We need to |
| 195 | // skip them, but we also require that there be an option to masquerade as |
| 196 | // argv[0], so we increment the argument indexes by 1 rather than by 2. |
| 197 | argc--; |
| 198 | argv++; |
| 199 | |
| 200 | // This is for backwards compatibility, ugly! ToDo: Remove for ATS v9.0.0 IMO. |
| 201 | if (argc > 1 && *argv[1] != '-') { |
| 202 | Dbg(dbg_ctl, "config file %s", argv[1]); |
| 203 | if (!config->readConfig(argv[1])) { |
| 204 | success = false; |
| 205 | } |
| 206 | } else { |
| 207 | if (!config->parseOptions(argc, const_cast<const char **>(argv))) { |
| 208 | success = false; |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | if (success) { |
| 213 | *ih = config; |
| 214 | |
| 215 | return TS_SUCCESS; |
| 216 | } |
| 217 | |
| 218 | // Something went wrong with the configuration setup. |
| 219 | delete config; |
| 220 | return TS_ERROR; |
| 221 | } |
| 222 | |
| 223 | void |
| 224 | TSRemapDeleteInstance(void *ih) |
nothing calls this directly
no test coverage detected