| 1177 | } |
| 1178 | |
| 1179 | void |
| 1180 | TSPluginInit(int argc, const char *argv[]) |
| 1181 | { |
| 1182 | const char *config_path = nullptr; |
| 1183 | compress_config_mutex = TSMutexCreate(); |
| 1184 | |
| 1185 | if (argc > 2) { |
| 1186 | fatal("the compress plugin does not accept more than 1 plugin argument"); |
| 1187 | } else { |
| 1188 | config_path = TSstrdup(2 == argc ? argv[1] : ""); |
| 1189 | } |
| 1190 | |
| 1191 | if (!register_plugin()) { |
| 1192 | fatal("the compress plugin failed to register"); |
| 1193 | } |
| 1194 | |
| 1195 | info("TSPluginInit %s", argv[0]); |
| 1196 | |
| 1197 | if (!global_hidden_header_name) { |
| 1198 | global_hidden_header_name = init_hidden_header_name(); |
| 1199 | } |
| 1200 | |
| 1201 | TSCont management_contp = TSContCreate(management_update, nullptr); |
| 1202 | |
| 1203 | // Make sure the global configuration is properly loaded and reloaded on changes |
| 1204 | TSContDataSet(management_contp, (void *)config_path); |
| 1205 | TSMgmtUpdateRegister(management_contp, TAG); |
| 1206 | load_global_configuration(management_contp); |
| 1207 | |
| 1208 | // Setup the global hook, main entry point for kicking off the plugin |
| 1209 | TSCont transform_global_contp = TSContCreate(transform_global_plugin, nullptr); |
| 1210 | |
| 1211 | TSHttpHookAdd(TS_HTTP_READ_REQUEST_HDR_HOOK, transform_global_contp); |
| 1212 | info("loaded"); |
| 1213 | } |
| 1214 | |
| 1215 | ////////////////////////////////////////////////////////////////////////////// |
| 1216 | // Initialize the plugin as a remap plugin. |
nothing calls this directly
no test coverage detected