| 248 | } |
| 249 | |
| 250 | void |
| 251 | HttpBodyFactory::reconfigure() |
| 252 | { |
| 253 | RecInt e; |
| 254 | RecString s = nullptr; |
| 255 | bool all_found; |
| 256 | int rec_err; |
| 257 | |
| 258 | lock(); |
| 259 | sanity_check(); |
| 260 | |
| 261 | if (!callbacks_established) { |
| 262 | unlock(); |
| 263 | return; |
| 264 | } // callbacks not setup right |
| 265 | |
| 266 | //////////////////////////////////////////// |
| 267 | // extract relevant records.yaml values // |
| 268 | //////////////////////////////////////////// |
| 269 | |
| 270 | Dbg(dbg_ctl_body_factory, "config variables changed, reconfiguring..."); |
| 271 | |
| 272 | all_found = true; |
| 273 | |
| 274 | // enable_customizations if records.yaml set |
| 275 | rec_err = RecGetRecordInt("proxy.config.body_factory.enable_customizations", &e); |
| 276 | enable_customizations = ((rec_err == REC_ERR_OKAY) ? e : 0); |
| 277 | all_found = all_found && (rec_err == REC_ERR_OKAY); |
| 278 | Dbg(dbg_ctl_body_factory, "enable_customizations = %d (found = %" PRId64 ")", enable_customizations, e); |
| 279 | |
| 280 | rec_err = RecGetRecordInt("proxy.config.body_factory.enable_logging", &e); |
| 281 | enable_logging = ((rec_err == REC_ERR_OKAY) ? (e ? true : false) : false); |
| 282 | all_found = all_found && (rec_err == REC_ERR_OKAY); |
| 283 | Dbg(dbg_ctl_body_factory, "enable_logging = %d (found = %" PRId64 ")", enable_logging, e); |
| 284 | |
| 285 | ats_scoped_str directory_of_template_sets; |
| 286 | |
| 287 | rec_err = RecGetRecordString_Xmalloc("proxy.config.body_factory.template_sets_dir", &s); |
| 288 | all_found = all_found && (rec_err == REC_ERR_OKAY); |
| 289 | if (rec_err == REC_ERR_OKAY) { |
| 290 | directory_of_template_sets = Layout::get()->relative(s); |
| 291 | if (access(directory_of_template_sets, R_OK) < 0) { |
| 292 | Warning("Unable to access() directory '%s': %d, %s", (const char *)directory_of_template_sets, errno, strerror(errno)); |
| 293 | if (TSSystemState::is_initializing()) { |
| 294 | Emergency(" Please set 'proxy.config.body_factory.template_sets_dir' "); |
| 295 | } else { |
| 296 | Warning(" Please set 'proxy.config.body_factory.template_sets_dir' "); |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | Dbg(dbg_ctl_body_factory, "directory_of_template_sets = '%s' ", (const char *)directory_of_template_sets); |
| 302 | |
| 303 | ats_free(s); |
| 304 | |
| 305 | if (!all_found) { |
| 306 | Warning("config changed, but can't fetch all proxy.config.body_factory values"); |
| 307 | } |
no test coverage detected