@@ -35,6 +35,7 @@ static const char *redirectionio_set_logs_enable(cmd_parms *cmd, void *cfg, cons
3535static const char * redirectionio_set_scheme (cmd_parms * cmd , void * cfg , const char * arg );
3636static const char * redirectionio_set_show_rule_ids (cmd_parms * cmd , void * cfg , const char * arg );
3737static const char * redirectionio_set_server (cmd_parms * cmd , void * dc , int argc , char * const argv []);
38+ static const char * redirectionio_set_header (cmd_parms * cmd , void * cfg , const char * arg1 , const char * arg2 );
3839static void redirectionio_apache_log_callback (const char * log_str , const void * data , short level );
3940static apr_status_t redirectionio_atoi (const char * line , apr_size_t len );
4041
@@ -45,6 +46,7 @@ static const command_rec redirectionio_directives[] = {
4546 AP_INIT_TAKE1 ("redirectionioLogs" , redirectionio_set_logs_enable , NULL , OR_ALL , "Enable or disable logging for redirectionio" ),
4647 AP_INIT_TAKE1 ("redirectionioScheme" , redirectionio_set_scheme , NULL , OR_ALL , "Force scheme to use when matching request" ),
4748 AP_INIT_TAKE1 ("redirectionioRuleIdsHeader" , redirectionio_set_show_rule_ids , NULL , OR_ALL , "Show rule ids used on response header" ),
49+ AP_INIT_TAKE2 ("redirectionioSetHeader" , redirectionio_set_header , NULL , OR_ALL , "Add header to match in redirectionio request" ),
4850 { NULL }
4951};
5052
@@ -506,6 +508,7 @@ static void *create_redirectionio_dir_conf(apr_pool_t *pool, char *context) {
506508 config -> server .timeout = RIO_TIMEOUT ;
507509 config -> pool = pool ;
508510 config -> show_rule_ids = -1 ;
511+ config -> headers_set = NULL ;
509512 }
510513
511514 return config ;
@@ -523,6 +526,14 @@ static void *merge_redirectionio_dir_conf(apr_pool_t *pool, void *parent, void *
523526 conf -> enable = conf_current -> enable ;
524527 }
525528
529+ if (conf_current -> headers_set == NULL ) {
530+ conf -> headers_set = conf_parent -> headers_set ;
531+ } else if (conf_parent -> headers_set == NULL ) {
532+ conf -> headers_set = conf_current -> headers_set ;
533+ } else {
534+ conf -> headers_set = apr_table_overlay (pool , conf_current -> headers_set , conf_parent -> headers_set );
535+ }
536+
526537 if (conf_current -> enable_logs == -1 ) {
527538 conf -> enable_logs = conf_parent -> enable_logs ;
528539 } else {
@@ -806,6 +817,18 @@ static const char *redirectionio_set_server(cmd_parms *cmd, void *cfg, int argc,
806817 return NULL ;
807818}
808819
820+ static const char * redirectionio_set_header (cmd_parms * cmd , void * cfg , const char * arg1 , const char * arg2 ) {
821+ redirectionio_config * conf = (redirectionio_config * )cfg ;
822+
823+ if (conf -> headers_set == NULL ) {
824+ conf -> headers_set = apr_table_make (conf -> pool , 10 );
825+ }
826+
827+ apr_table_set (conf -> headers_set , arg1 , arg2 );
828+
829+ return NULL ;
830+ }
831+
809832static void redirectionio_apache_log_callback (const char * log_str , const void * data , short level ) {
810833 if (level <= 1 ) {
811834 ap_log_rerror (APLOG_MARK , APLOG_ERR , 0 , (request_rec * )data , "mod_redirectionio api error: %s" , log_str );
0 commit comments