View | Details | Raw Unified | Return to bug 44518
Collapse All | Expand All

(-)/Users/jerome/Downloads/softs/apache-trunk/modules/metadata/mod_expires.c (-1 / +36 lines)
Lines 167-172 Link Here
167
167
168
typedef struct {
168
typedef struct {
169
    int active;
169
    int active;
170
    int ignore_redirect;
170
    int wildcards;
171
    int wildcards;
171
    char *expiresdefault;
172
    char *expiresdefault;
172
    apr_table_t *expiresbytype;
173
    apr_table_t *expiresbytype;
Lines 180-185 Link Here
180
#define ACTIVE_OFF      0
181
#define ACTIVE_OFF      0
181
#define ACTIVE_DONTCARE 2
182
#define ACTIVE_DONTCARE 2
182
183
184
#define IGNORE_REDIRECT_YES 1
185
#define IGNORE_REDIRECT_NO  0
186
183
module AP_MODULE_DECLARE_DATA expires_module;
187
module AP_MODULE_DECLARE_DATA expires_module;
184
188
185
static void *create_dir_expires_config(apr_pool_t *p, char *dummy)
189
static void *create_dir_expires_config(apr_pool_t *p, char *dummy)
Lines 187-192 Link Here
187
    expires_dir_config *new =
191
    expires_dir_config *new =
188
    (expires_dir_config *) apr_pcalloc(p, sizeof(expires_dir_config));
192
    (expires_dir_config *) apr_pcalloc(p, sizeof(expires_dir_config));
189
    new->active = ACTIVE_DONTCARE;
193
    new->active = ACTIVE_DONTCARE;
194
    new->ignore_redirect = IGNORE_REDIRECT_NO;
190
    new->wildcards = 0;
195
    new->wildcards = 0;
191
    new->expiresdefault = NULL;
196
    new->expiresdefault = NULL;
192
    new->expiresbytype = apr_table_make(p, 4);
197
    new->expiresbytype = apr_table_make(p, 4);
Lines 204-209 Link Here
204
    if (arg == 0) {
209
    if (arg == 0) {
205
        dir_config->active = ACTIVE_OFF;
210
        dir_config->active = ACTIVE_OFF;
206
    }
211
    }
212
213
    return NULL;
214
}
215
216
static const char *set_expiresignoreredirect(cmd_parms *cmd, void *in_dir_config, const char *code)
217
{
218
    expires_dir_config *dir_config = in_dir_config;
219
220
    if(strcmp(code, "Yes") == 0) {
221
        dir_config->ignore_redirect = IGNORE_REDIRECT_YES;
222
    }
223
207
    return NULL;
224
    return NULL;
208
}
225
}
209
226
Lines 358-363 Link Here
358
                  "a MIME type followed by an expiry date code"),
375
                  "a MIME type followed by an expiry date code"),
359
    AP_INIT_TAKE1("ExpiresDefault", set_expiresdefault, NULL, DIR_CMD_PERMS,
376
    AP_INIT_TAKE1("ExpiresDefault", set_expiresdefault, NULL, DIR_CMD_PERMS,
360
                  "an expiry date code"),
377
                  "an expiry date code"),
378
    AP_INIT_TAKE1("ExpiresIgnoreRedirect", set_expiresignoreredirect, NULL, DIR_CMD_PERMS,
379
                  "Wether to ignore Location headers or not, possible values 'Yes' or 'No', default is 'No'"),
361
    {NULL}
380
    {NULL}
362
};
381
};
363
382
Lines 383-388 Link Here
383
    new->wildcards = add->wildcards;
402
    new->wildcards = add->wildcards;
384
    new->expiresbytype = apr_table_overlay(p, add->expiresbytype,
403
    new->expiresbytype = apr_table_overlay(p, add->expiresbytype,
385
                                        base->expiresbytype);
404
                                        base->expiresbytype);
405
406
    new->ignore_redirect = add->ignore_redirect;
407
386
    return new;
408
    return new;
387
}
409
}
388
410
Lines 459-464 Link Here
459
    conf = (expires_dir_config *) ap_get_module_config(r->per_dir_config,
481
    conf = (expires_dir_config *) ap_get_module_config(r->per_dir_config,
460
                                                       &expires_module);
482
                                                       &expires_module);
461
483
484
    /* Found a "Location" header, do not send "Expires" */
485
    if(conf->ignore_redirect == IGNORE_REDIRECT_NO) {
486
        if(apr_table_get(r->err_headers_out, "Location") != NULL) {
487
            ap_remove_output_filter(f);
488
            return ap_pass_brigade(f->next, b);
489
        }
490
491
        if(apr_table_get(r->headers_out, "Location") != NULL) {
492
            ap_remove_output_filter(f);
493
            return ap_pass_brigade(f->next, b);
494
        }
495
    }
496
462
    /*
497
    /*
463
     * Check to see which output header table we should use;
498
     * Check to see which output header table we should use;
464
     * mod_cgi loads script fields into r->err_headers_out,
499
     * mod_cgi loads script fields into r->err_headers_out,
Lines 566-569 Link Here
566
    NULL,                       /* merge server configs */
601
    NULL,                       /* merge server configs */
567
    expires_cmds,               /* command apr_table_t */
602
    expires_cmds,               /* command apr_table_t */
568
    register_hooks              /* register hooks */
603
    register_hooks              /* register hooks */
569
};
604
};

Return to bug 44518