@@ -35,6 +35,7 @@ static const char *redirectionio_set_logs_enable(cmd_parms *cmd, void *cfg, cons
35
35
static const char * redirectionio_set_scheme (cmd_parms * cmd , void * cfg , const char * arg );
36
36
static const char * redirectionio_set_show_rule_ids (cmd_parms * cmd , void * cfg , const char * arg );
37
37
static 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 );
38
39
static void redirectionio_apache_log_callback (const char * log_str , const void * data , short level );
39
40
static apr_status_t redirectionio_atoi (const char * line , apr_size_t len );
40
41
@@ -45,6 +46,7 @@ static const command_rec redirectionio_directives[] = {
45
46
AP_INIT_TAKE1 ("redirectionioLogs" , redirectionio_set_logs_enable , NULL , OR_ALL , "Enable or disable logging for redirectionio" ),
46
47
AP_INIT_TAKE1 ("redirectionioScheme" , redirectionio_set_scheme , NULL , OR_ALL , "Force scheme to use when matching request" ),
47
48
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" ),
48
50
{ NULL }
49
51
};
50
52
@@ -506,6 +508,7 @@ static void *create_redirectionio_dir_conf(apr_pool_t *pool, char *context) {
506
508
config -> server .timeout = RIO_TIMEOUT ;
507
509
config -> pool = pool ;
508
510
config -> show_rule_ids = -1 ;
511
+ config -> headers_set = NULL ;
509
512
}
510
513
511
514
return config ;
@@ -523,6 +526,14 @@ static void *merge_redirectionio_dir_conf(apr_pool_t *pool, void *parent, void *
523
526
conf -> enable = conf_current -> enable ;
524
527
}
525
528
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
+
526
537
if (conf_current -> enable_logs == -1 ) {
527
538
conf -> enable_logs = conf_parent -> enable_logs ;
528
539
} else {
@@ -806,6 +817,18 @@ static const char *redirectionio_set_server(cmd_parms *cmd, void *cfg, int argc,
806
817
return NULL ;
807
818
}
808
819
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
+
809
832
static void redirectionio_apache_log_callback (const char * log_str , const void * data , short level ) {
810
833
if (level <= 1 ) {
811
834
ap_log_rerror (APLOG_MARK , APLOG_ERR , 0 , (request_rec * )data , "mod_redirectionio api error: %s" , log_str );
0 commit comments