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

(-)httpd-2.4.12/modules/loggers/mod_log_config.c.orig (-16 / +48 lines)
Lines 368-381 static const char *log_request_file(requ Link Here
368
{
368
{
369
    return ap_escape_logitem(r->pool, r->filename);
369
    return ap_escape_logitem(r->pool, r->filename);
370
}
370
}
371
371
static const char *log_request_uri(request_rec *r, char *a)
372
static const char *log_request_uri(request_rec *r, char *a)
372
{
373
{
373
    return ap_escape_logitem(r->pool, r->uri);
374
    return ap_escape_logitem(r->pool, r->uri);
374
}
375
}
376
375
static const char *log_request_method(request_rec *r, char *a)
377
static const char *log_request_method(request_rec *r, char *a)
376
{
378
{
377
    return ap_escape_logitem(r->pool, r->method);
379
    return ap_escape_logitem(r->pool, r->method);
378
}
380
}
381
379
static const char *log_log_id(request_rec *r, char *a)
382
static const char *log_log_id(request_rec *r, char *a)
380
{
383
{
381
    if (a && !strcmp(a, "c")) {
384
    if (a && !strcmp(a, "c")) {
Lines 385-400 static const char *log_log_id(request_re Link Here
385
        return r->log_id ? r->log_id : "-";
388
        return r->log_id ? r->log_id : "-";
386
    }
389
    }
387
}
390
}
391
388
static const char *log_request_protocol(request_rec *r, char *a)
392
static const char *log_request_protocol(request_rec *r, char *a)
389
{
393
{
390
    return ap_escape_logitem(r->pool, r->protocol);
394
    return ap_escape_logitem(r->pool, r->protocol);
391
}
395
}
396
392
static const char *log_request_query(request_rec *r, char *a)
397
static const char *log_request_query(request_rec *r, char *a)
393
{
398
{
394
    return (r->args) ? apr_pstrcat(r->pool, "?",
399
    return (r->args) ? apr_pstrcat(r->pool, "?",
395
                                   ap_escape_logitem(r->pool, r->args), NULL)
400
                                   ap_escape_logitem(r->pool, r->args), NULL)
396
                     : "";
401
                     : "";
397
}
402
}
403
398
static const char *log_status(request_rec *r, char *a)
404
static const char *log_status(request_rec *r, char *a)
399
{
405
{
400
    return pfmt(r->pool, r->status);
406
    return pfmt(r->pool, r->status);
Lines 425-445 static const char *log_bytes_sent(reques Link Here
425
    }
431
    }
426
}
432
}
427
433
428
429
static const char *log_header_in(request_rec *r, char *a)
430
{
431
    return ap_escape_logitem(r->pool, apr_table_get(r->headers_in, a));
432
}
433
434
static const char *log_trailer_in(request_rec *r, char *a)
435
{
436
    return ap_escape_logitem(r->pool, apr_table_get(r->trailers_in, a));
437
}
438
439
440
static APR_INLINE char *find_multiple_headers(apr_pool_t *pool,
434
static APR_INLINE char *find_multiple_headers(apr_pool_t *pool,
441
                                              const apr_table_t *table,
435
                                              const apr_table_t *table,
442
                                              const char *key)
436
                                              const char *key,
437
                                              int match_wildcard)
443
{
438
{
444
    const apr_array_header_t *elts;
439
    const apr_array_header_t *elts;
445
    const apr_table_entry_t *t_elt;
440
    const apr_table_entry_t *t_elt;
Lines 447-453 static APR_INLINE char *find_multiple_he Link Here
447
    apr_size_t len;
442
    apr_size_t len;
448
    struct sle {
443
    struct sle {
449
        struct sle *next;
444
        struct sle *next;
445
        const char *key;
450
        const char *value;
446
        const char *value;
447
        apr_size_t keylen;
451
        apr_size_t len;
448
        apr_size_t len;
452
    } *result_list, *rp;
449
    } *result_list, *rp;
453
450
Lines 463-469 static APR_INLINE char *find_multiple_he Link Here
463
    result_list = rp = NULL;
460
    result_list = rp = NULL;
464
461
465
    do {
462
    do {
466
        if (!strcasecmp(t_elt->key, key)) {
463
        if (!strcasecmp(t_elt->key, key) ||
464
            (match_wildcard && !ap_strcasecmp_match(t_elt->key, key))) {
467
            if (!result_list) {
465
            if (!result_list) {
468
                result_list = rp = apr_palloc(pool, sizeof(*rp));
466
                result_list = rp = apr_palloc(pool, sizeof(*rp));
469
            }
467
            }
Lines 476-481 static APR_INLINE char *find_multiple_he Link Here
476
            rp->value = t_elt->val;
474
            rp->value = t_elt->val;
477
            rp->len = strlen(rp->value);
475
            rp->len = strlen(rp->value);
478
476
477
            if (match_wildcard) {
478
                rp->key = t_elt->key;
479
                rp->keylen = strlen(rp->key);
480
                len += rp->keylen + 2; /* "<key>: " */
481
            }
482
479
            len += rp->len;
483
            len += rp->len;
480
        }
484
        }
481
        ++t_elt;
485
        ++t_elt;
Lines 491-496 static APR_INLINE char *find_multiple_he Link Here
491
                *cp++ = ',';
495
                *cp++ = ',';
492
                *cp++ = ' ';
496
                *cp++ = ' ';
493
            }
497
            }
498
            if (match_wildcard) {
499
                memcpy(cp, rp->key, rp->keylen);
500
                cp += rp->keylen;
501
                *cp++ = ':';
502
                *cp++ = ' ';
503
            }
494
            memcpy(cp, rp->value, rp->len);
504
            memcpy(cp, rp->value, rp->len);
495
            cp += rp->len;
505
            cp += rp->len;
496
            rp = rp->next;
506
            rp = rp->next;
Lines 503-517 static APR_INLINE char *find_multiple_he Link Here
503
    return NULL;
513
    return NULL;
504
}
514
}
505
515
516
static const char *log_header_in(request_rec *r, char *a)
517
{
518
    const char *cp = NULL;
519
    int is_wildcard = ap_is_matchexp(a);
520
521
    if (is_wildcard) {
522
        cp = find_multiple_headers(r->pool, r->headers_in, a, is_wildcard);
523
    }
524
    else {
525
        cp = apr_table_get(r->headers_in, a);
526
    }
527
528
    return ap_escape_logitem(r->pool, cp);
529
}
530
531
static const char *log_trailer_in(request_rec *r, char *a)
532
{
533
    return ap_escape_logitem(r->pool, apr_table_get(r->trailers_in, a));
534
}
535
506
static const char *log_header_out(request_rec *r, char *a)
536
static const char *log_header_out(request_rec *r, char *a)
507
{
537
{
508
    const char *cp = NULL;
538
    const char *cp = NULL;
539
    int is_wildcard = ap_is_matchexp(a);
509
540
510
    if (!strcasecmp(a, "Content-type") && r->content_type) {
541
    if (!strcasecmp(a, "Content-type") && r->content_type) {
511
        cp = ap_field_noparam(r->pool, r->content_type);
542
        cp = ap_field_noparam(r->pool, r->content_type);
512
    }
543
    }
513
    else if (!strcasecmp(a, "Set-Cookie")) {
544
    else if (!strcasecmp(a, "Set-Cookie") || is_wildcard) {
514
        cp = find_multiple_headers(r->pool, r->headers_out, a);
545
        cp = find_multiple_headers(r->pool, r->headers_out, a, is_wildcard);
515
    }
546
    }
516
    else {
547
    else {
517
        cp = apr_table_get(r->headers_out, a);
548
        cp = apr_table_get(r->headers_out, a);
Lines 529-534 static const char *log_note(request_rec Link Here
529
{
560
{
530
    return ap_escape_logitem(r->pool, apr_table_get(r->notes, a));
561
    return ap_escape_logitem(r->pool, apr_table_get(r->notes, a));
531
}
562
}
563
532
static const char *log_env_var(request_rec *r, char *a)
564
static const char *log_env_var(request_rec *r, char *a)
533
{
565
{
534
    return ap_escape_logitem(r->pool, apr_table_get(r->subprocess_env, a));
566
    return ap_escape_logitem(r->pool, apr_table_get(r->subprocess_env, a));

Return to bug 57710