~britco/nginx/nginx

« back to all changes in this revision

Viewing changes to src/http/ngx_http_file_cache.c

  • Committer: Package Import Robot
  • Author(s): Kartik Mistry, Kartik Mistry, Michael Lustfield
  • Date: 2011-12-14 09:45:40 UTC
  • mfrom: (4.2.41 sid)
  • Revision ID: package-import@ubuntu.com-20111214094540-gf1xvtpl224oeenb
Tags: 1.1.11-1
[Kartik Mistry]
* New upstream release.
* debian/control:
  + Set priority to extra for nginx-light and nginx-extras binaries
    (Policy: Section 2.5)
* debian/patches/607418-ipv6-addresses.diff:
  + Removed. Merged upstream with 1.1.9 release.
* debian/copyright:
  + Updated upstream copyright year, updated Michael's email address, misc
    changes for format.

[Michael Lustfield]
* debian/conf/fastcgi_params:
  + Changed $server_https to $https per new feature in 1.1.11.
* debian/conf/nginx.conf:
  + Removed map for $server_https as it's no longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
386
386
        return NGX_DECLINED;
387
387
    }
388
388
 
 
389
    if (h->body_start > c->body_start) {
 
390
        ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
 
391
                      "cache file \"%s\" has too long header",
 
392
                      c->file.name.data);
 
393
        return NGX_DECLINED;
 
394
    }
 
395
 
389
396
    c->buf->last += n;
390
397
 
391
398
    c->valid_sec = h->valid_sec;
1106
1113
        /*
1107
1114
         * abnormally exited workers may leave locked cache entries,
1108
1115
         * and although it may be safe to remove them completely,
1109
 
         * we prefer to remove them from inactive queue and rbtree
1110
 
         * only, and to allow other leaks
 
1116
         * we prefer to just move them to the top of the inactive queue
1111
1117
         */
1112
1118
 
1113
1119
        ngx_queue_remove(q);
1114
 
        ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
 
1120
        fcn->expire = ngx_time() + cache->inactive;
 
1121
        ngx_queue_insert_head(&cache->sh->queue, &fcn->queue);
1115
1122
 
1116
1123
        ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
1117
1124
                      "ignore long locked inactive cache entry %*s, count:%d",
1752
1759
 
1753
1760
    return NGX_CONF_OK;
1754
1761
}
1755
 
 
1756
 
 
1757
 
ngx_int_t
1758
 
ngx_http_cache(ngx_http_request_t *r, ngx_array_t *no_cache)
1759
 
{
1760
 
    ngx_str_t                  val;
1761
 
    ngx_uint_t                 i;
1762
 
    ngx_http_complex_value_t  *cv;
1763
 
 
1764
 
    cv = no_cache->elts;
1765
 
 
1766
 
    for (i = 0; i < no_cache->nelts; i++) {
1767
 
        if (ngx_http_complex_value(r, &cv[i], &val) != NGX_OK) {
1768
 
            return NGX_ERROR;
1769
 
        }
1770
 
 
1771
 
        if (val.len && val.data[0] != '0') {
1772
 
            return NGX_DECLINED;
1773
 
        }
1774
 
    }
1775
 
 
1776
 
    return NGX_OK;
1777
 
}
1778
 
 
1779
 
 
1780
 
char *
1781
 
ngx_http_no_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1782
 
{
1783
 
    char  *p = conf;
1784
 
 
1785
 
    ngx_str_t                          *value;
1786
 
    ngx_uint_t                          i;
1787
 
    ngx_array_t                       **a;
1788
 
    ngx_http_complex_value_t           *cv;
1789
 
    ngx_http_compile_complex_value_t    ccv;
1790
 
 
1791
 
    a = (ngx_array_t **) (p + cmd->offset);
1792
 
 
1793
 
    if (*a == NGX_CONF_UNSET_PTR) {
1794
 
        *a = ngx_array_create(cf->pool, 1, sizeof(ngx_http_complex_value_t));
1795
 
        if (*a == NULL) {
1796
 
            return NGX_CONF_ERROR;
1797
 
        }
1798
 
    }
1799
 
 
1800
 
    value = cf->args->elts;
1801
 
 
1802
 
    for (i = 1; i < cf->args->nelts; i++) {
1803
 
        cv = ngx_array_push(*a);
1804
 
        if (cv == NULL) {
1805
 
            return NGX_CONF_ERROR;
1806
 
        }
1807
 
 
1808
 
        ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
1809
 
 
1810
 
        ccv.cf = cf;
1811
 
        ccv.value = &value[i];
1812
 
        ccv.complex_value = cv;
1813
 
 
1814
 
        if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
1815
 
            return NGX_CONF_ERROR;
1816
 
        }
1817
 
    }
1818
 
 
1819
 
    return NGX_CONF_OK;
1820
 
}