~britco/nginx/master

« back to all changes in this revision

Viewing changes to src/http/modules/ngx_http_ssi_filter_module.c

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry, Kartik Mistry, Michael Lustfield
  • Date: 2010-11-27 21:04:02 UTC
  • mfrom: (1.3.8 upstream)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20101127210402-14sgjpe6r3jup8a9
Tags: 0.8.53-1
[Kartik Mistry]
* debian/control:
  + Added Michael Lustfield as co-maintainer
* nginx.conf:
  + No need to use regex in gzip_disable for msie6, Thanks to António P. P.
    Almeida <appa@perusio.net> (Closes: #592147)
* conf/sites-available/default:
  + Fixed typo for "include fastcgi", Thanks to Mostafa Ghadamyari
    <nginx@gigfa.com> (Closes: #593142, #593143)
* debian/patches/fix_reloading_ipv6.diff:
  + Removed, merged upstream
* debian/init.d:
  + Added fix to control nginx by user in a simple way by setting DAEMON
    variable to an invalid name in /etc/default/nginx. Patch by Toni Mueller
    <support@oeko.net> (Closes: #594598)
* debian/NEWS.Debian:
  + Updated news for 0.8.x as stable branch

[Michael Lustfield]
* New upstream release (Closes: #602970)
  + 0.8.x branch is declared stable by upstream now
* Add a UFW profile set:
  + debian/nginx.ufw.profile: Added.
  + debian/control: nginx: Suggests ufw.
  + debian/dirs: Add 'etc/ufw/applications.d'
  + debian/rules: Add install rule for the nginx UFW profile.
* Moved debian/dirs to debian/nginx.dirs
* Added types_hash_max_size to nginx.conf
* Install simple default index.html file (Closes: #581416)
  + debian/dirs: Add 'usr/share/nginx/www'.
  + debian/nginx.install: Add 'html/* usr/share/nginx/www'.
* debian/patches/nginx-echo.diff:
  + Added Echo module
* Added files for nginx.docs
  - /usr/share/doc/nginx/
    + debian/help/docs/fcgiwrap
    + debian/help/docs/php
    + debian/help/docs/support-irc
    + debian/help/docs/upstream
* Added files for nginx.examples
  - /usr/share/doc/nginx/examples/
    + debian/help/docs/drupal
    + debian/help/docs/http
    + debian/help/docs/mail
    + debian/help/docs/mailman
    + debian/help/docs/nginx.conf
    + debian/help/docs/virtual_hosts
    + debian/help/docs/wordpress
* debian/conf/:
  + Removed excess spaces
  + Added tabs where appropriate
  + Added SCRIPT_FILENAME to fastcgi_params

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
 
71
71
static ngx_int_t ngx_http_ssi_output(ngx_http_request_t *r,
72
72
    ngx_http_ssi_ctx_t *ctx);
 
73
static void ngx_http_ssi_buffered(ngx_http_request_t *r,
 
74
    ngx_http_ssi_ctx_t *ctx);
73
75
static ngx_int_t ngx_http_ssi_parse(ngx_http_request_t *r,
74
76
    ngx_http_ssi_ctx_t *ctx);
75
77
static ngx_str_t *ngx_http_ssi_get_variable(ngx_http_request_t *r,
346
348
    ctx->params.nalloc = NGX_HTTP_SSI_PARAMS_N;
347
349
    ctx->params.pool = r->pool;
348
350
 
349
 
    ctx->timefmt.len = sizeof("%A, %d-%b-%Y %H:%M:%S %Z") - 1;
350
 
    ctx->timefmt.data = (u_char *) "%A, %d-%b-%Y %H:%M:%S %Z";
351
 
 
352
 
    ctx->errmsg.len =
353
 
              sizeof("[an error occurred while processing the directive]") - 1;
354
 
    ctx->errmsg.data = (u_char *)
355
 
                     "[an error occurred while processing the directive]";
 
351
    ngx_str_set(&ctx->timefmt, "%A, %d-%b-%Y %H:%M:%S %Z");
 
352
    ngx_str_set(&ctx->errmsg,
 
353
                "[an error occurred while processing the directive]");
356
354
 
357
355
    r->filter_need_in_memory = 1;
358
356
 
435
433
 
436
434
    while (ctx->in || ctx->buf) {
437
435
 
438
 
        if (ctx->buf == NULL ){
 
436
        if (ctx->buf == NULL) {
439
437
            ctx->buf = ctx->in->buf;
440
438
            ctx->in = ctx->in->next;
441
439
            ctx->pos = ctx->buf->pos;
797
795
                }
798
796
 
799
797
                if (rc == NGX_DONE || rc == NGX_AGAIN || rc == NGX_ERROR) {
 
798
                    ngx_http_ssi_buffered(r, ctx);
800
799
                    return rc;
801
800
                }
802
801
            }
949
948
        }
950
949
    }
951
950
 
 
951
    ngx_http_ssi_buffered(r, ctx);
 
952
 
 
953
    return rc;
 
954
}
 
955
 
 
956
 
 
957
static void
 
958
ngx_http_ssi_buffered(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx)
 
959
{
952
960
    if (ctx->in || ctx->buf) {
953
961
        r->buffered |= NGX_HTTP_SSI_BUFFERED;
954
962
 
955
963
    } else {
956
964
        r->buffered &= ~NGX_HTTP_SSI_BUFFERED;
957
965
    }
958
 
 
959
 
    return rc;
960
966
}
961
967
 
962
968
 
1904
1910
    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1905
1911
                   "ssi include: \"%V\"", uri);
1906
1912
 
1907
 
    args.len = 0;
1908
 
    args.data = NULL;
 
1913
    ngx_str_null(&args);
1909
1914
    flags = NGX_HTTP_LOG_UNSAFE;
1910
1915
 
1911
1916
    if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) {
2447
2452
 
2448
2453
    } else {
2449
2454
#if (NGX_PCRE)
2450
 
        ngx_str_t     err;
2451
 
        ngx_regex_t  *regex;
2452
 
        u_char        errstr[NGX_MAX_CONF_ERRSTR];
2453
 
 
2454
 
        err.len = NGX_MAX_CONF_ERRSTR;
2455
 
        err.data = errstr;
 
2455
        ngx_regex_compile_t  rgc;
 
2456
        u_char               errstr[NGX_MAX_CONF_ERRSTR];
2456
2457
 
2457
2458
        right.data[right.len] = '\0';
2458
2459
 
2459
 
        regex = ngx_regex_compile(&right, 0, r->pool, &err);
2460
 
 
2461
 
        if (regex == NULL) {
2462
 
            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "%s", err.data);
 
2460
        ngx_memzero(&rgc, sizeof(ngx_regex_compile_t));
 
2461
 
 
2462
        rgc.pattern = right;
 
2463
        rgc.pool = r->pool;
 
2464
        rgc.err.len = NGX_MAX_CONF_ERRSTR;
 
2465
        rgc.err.data = errstr;
 
2466
 
 
2467
        if (ngx_regex_compile(&rgc) != NGX_OK) {
 
2468
            ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "%V", &rgc.err);
2463
2469
            return NGX_HTTP_SSI_ERROR;
2464
2470
        }
2465
2471
 
2466
 
        rc = ngx_regex_exec(regex, &left, NULL, 0);
 
2472
        rc = ngx_regex_exec(rgc.regex, &left, NULL, 0);
2467
2473
 
2468
 
        if (rc != NGX_REGEX_NO_MATCHED && rc < 0) {
 
2474
        if (rc < NGX_REGEX_NO_MATCHED) {
2469
2475
            ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
2470
 
                          ngx_regex_exec_n " failed: %d on \"%V\" using \"%V\"",
 
2476
                          ngx_regex_exec_n " failed: %i on \"%V\" using \"%V\"",
2471
2477
                          rc, &left, &right);
2472
2478
            return NGX_HTTP_SSI_ERROR;
2473
2479
        }
2768
2774
    ngx_conf_merge_size_value(conf->min_file_chunk, prev->min_file_chunk, 1024);
2769
2775
    ngx_conf_merge_size_value(conf->value_len, prev->value_len, 256);
2770
2776
 
2771
 
    if (ngx_http_merge_types(cf, conf->types_keys, &conf->types,
2772
 
                             prev->types_keys, &prev->types,
 
2777
    if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
 
2778
                             &prev->types_keys, &prev->types,
2773
2779
                             ngx_http_html_default_types)
2774
2780
        != NGX_OK)
2775
2781
    {