Changeset e7b311


Ignore:
Timestamp:
02/03/09 19:41:37 (3 years ago)
Author:
George Potapov <nephrite@…>
Branches:
master-v0.7, nginx-v0.7, nginx-v0.8, upstream_count_limit
Children:
2ac4f5
Parents:
2240a4
git-author:
George Potapov <nephrite@…> (02/03/09 19:41:37)
git-committer:
George Potapov <nephrite@…> (02/03/09 19:41:37)
Message:

vendor drop nginx 0.7.31

Location:
server
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • server/CHANGES

    r2240a4 re7b311  
     1 
     2Changes with nginx 0.7.31                                        19 Jan 2009 
     3 
     4    *) Change: now the "try_files" directive tests files only and ignores  
     5       directories. 
     6 
     7    *) Feature: the "fastcgi_split_path_info" directive. 
     8 
     9    *) Bugfixes in an "Expect" request header line support. 
     10 
     11    *) Bugfixes in geo ranges. 
     12 
     13    *) Bugfix: in a miss case ngx_http_memcached_module returned the "END"  
     14       line as response body instead of default 404 page body; the bug had  
     15       appeared in 0.7.18. 
     16       Thanks to Maxim Dounin. 
     17 
     18    *) Bugfix: while SMTP proxying nginx issued message "250 2.0.0 OK"  
     19       instead of "235 2.0.0 OK"; the bug had appeared in 0.7.22. 
     20       Thanks to Maxim Dounin. 
     21 
    122 
    223Changes with nginx 0.7.30                                        24 Dec 2008 
    324 
    425    *) Bugfix: a segmentation fault occurred in worker process, if  
    5        variables were used in the "fastcgi_pass" and "proxy_pass"  
    6        directives and host name must be resolved; the bug had appeared in  
    7        0.7.29. 
     26       variables were used in the "fastcgi_pass" or "proxy_pass" directives  
     27       and host name must be resolved; the bug had appeared in 0.7.29. 
    828 
    929 
  • server/CHANGES.ru

    r2240a4 re7b311  
     1 
     2éÚÍÅÎÅÎÉÑ × nginx 0.7.31                                          19.01.2009 
     3 
     4    *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ ÄÉÒÅËÔÉ×Á try_files ÐÒÏ×ÅÒÑÅÔ ÔÏÌØËÏ ÆÁÊÌÙ,  
     5       ÉÇÎÏÒÉÒÕÑ ËÁÔÁÌÏÇÉ. 
     6 
     7    *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á fastcgi_split_path_info. 
     8 
     9    *) éÓÐÒÁ×ÌÅÎÉÑ × ÐÏÄÄÅÒÖËÅ ÓÔÒÏËÉ "Expect" × ÚÁÇÏÌÏ×ËÅ ÚÁÐÒÏÓÁ. 
     10 
     11    *) éÓÐÒÁ×ÌÅÎÉÑ × ÇÅÏ-ÄÉÁÐÁÚÏÎÁÈ. 
     12 
     13    *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÒÉ ÏÔÓÕÔÓÔ×ÉÉ ÏÔ×ÅÔÁ ngx_http_memcached_module  
     14       ×ÏÚ×ÒÁÝÁÌ × ÔÅÌÅ ÏÔ×ÅÔÁ ÓÔÒÏËÕ "END" ×ÍÅÓÔÏ 404-ÏÊ ÓÔÒÁÎÉÃÙ ÐÏ  
     15       ÕÍÏÌÞÁÎÉÀ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.18. 
     16       óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ. 
     17 
     18    *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÒÉ ÐÒÏËÓÉÒÏ×ÁÎÉÉ SMPT nginx ×ÙÄÁ×ÁÌ ÓÏÏÂÝÅÎÉÅ  
     19       "250 2.0.0 OK" ×ÍÅÓÔÏ "235 2.0.0 OK"; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.22. 
     20       óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ. 
     21 
    122 
    223éÚÍÅÎÅÎÉÑ × nginx 0.7.30                                          24.12.2008 
    324 
    425    *) éÓÐÒÁ×ÌÅÎÉÅ: × ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÐÒÏÉÓÈÏÄÉÌ segmentation fault, ÅÓÌÉ  
    5        × ÄÉÒÅËÔÉ×ÁÈ fastcgi_pass É proxy_pass ÉÓÐÏÌØÚÏ×ÁÌÉÓØ ÐÅÒÅÍÅÎÎÙÅ É  
     26       × ÄÉÒÅËÔÉ×ÁÈ fastcgi_pass ÉÌÉ proxy_pass ÉÓÐÏÌØÚÏ×ÁÌÉÓØ ÐÅÒÅÍÅÎÎÙÅ É  
    627       ÉÍÑ ÈÏÓÔÁ ÄÏÌÖÎÏ ÂÙÌÏ ÒÅÚÏÌ×ÉÔØÓÑ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.29. 
    728 
  • server/LICENSE

    rcef790 re7b311  
    11/*  
    2  * Copyright (C) 2002-2008 Igor Sysoev 
     2 * Copyright (C) 2002-2009 Igor Sysoev 
    33 * 
    44 * Redistribution and use in source and binary forms, with or without 
     
    2222 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
    2323 * SUCH DAMAGE. 
    24  * 
    2524 */ 
  • server/src/core/nginx.h

    r2240a4 re7b311  
    99 
    1010 
    11 #define NGINX_VERSION      "0.7.30" 
     11#define NGINX_VERSION      "0.7.31" 
    1212#define NGINX_VER          "nginx/" NGINX_VERSION 
    1313 
  • server/src/core/ngx_cycle.c

    r0f43eb re7b311  
    395395    pool->log = cycle->new_log; 
    396396 
    397     if (cycle->log->log_level == 0) { 
    398         cycle->log->log_level = NGX_LOG_ERR; 
    399     } 
    400  
    401397 
    402398    /* create shared memory */ 
  • server/src/core/ngx_log.c

    rb82943 re7b311  
    303303    } 
    304304 
    305     if (log->log_level == NGX_LOG_DEBUG) { 
     305    if (log->log_level == 0) { 
     306        log->log_level = NGX_LOG_ERR; 
     307 
     308    } else if (log->log_level == NGX_LOG_DEBUG) { 
    306309        log->log_level = NGX_LOG_DEBUG_ALL; 
    307310    } 
  • server/src/core/ngx_slab.c

    r08686b re7b311  
    686686 
    687687    ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, NGX_ENOMEM, 
    688                       "ngx_slab_alloc(): failed"); 
     688                  "ngx_slab_alloc(): failed"); 
    689689 
    690690    return NULL; 
  • server/src/http/modules/ngx_http_fastcgi_module.c

    r2240a4 re7b311  
    2323    ngx_array_t                   *fastcgi_lengths; 
    2424    ngx_array_t                   *fastcgi_values; 
     25 
     26#if (NGX_PCRE) 
     27    ngx_regex_t                   *split_regex; 
     28    ngx_str_t                      split_name; 
     29#endif 
    2530} ngx_http_fastcgi_loc_conf_t; 
    2631 
     
    5762 
    5863    ngx_array_t                   *split_parts; 
     64 
     65    ngx_str_t                      script_name; 
     66    ngx_str_t                      path_info; 
    5967} ngx_http_fastcgi_ctx_t; 
    6068 
     
    126134static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, 
    127135    ngx_http_variable_value_t *v, uintptr_t data); 
     136static ngx_int_t ngx_http_fastcgi_path_info_variable(ngx_http_request_t *r, 
     137    ngx_http_variable_value_t *v, uintptr_t data); 
     138static ngx_int_t ngx_http_fastcgi_split(ngx_http_request_t *r, 
     139    ngx_http_fastcgi_ctx_t *f, ngx_http_fastcgi_loc_conf_t *flcf); 
    128140 
    129141static char *ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, 
    130142    void *conf); 
     143static char *ngx_http_fastcgi_split_path_info(ngx_conf_t *cf, 
     144    ngx_command_t *cmd, void *conf); 
    131145static char *ngx_http_fastcgi_store(ngx_conf_t *cf, ngx_command_t *cmd, 
    132146    void *conf); 
     
    170184      NGX_HTTP_LOC_CONF_OFFSET, 
    171185      offsetof(ngx_http_fastcgi_loc_conf_t, index), 
     186      NULL }, 
     187 
     188    { ngx_string("fastcgi_split_path_info"), 
     189      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 
     190      ngx_http_fastcgi_split_path_info, 
     191      NGX_HTTP_LOC_CONF_OFFSET, 
     192      0, 
    172193      NULL }, 
    173194 
     
    391412 
    392413 
    393 static ngx_str_t  ngx_http_fastcgi_script_name = 
    394     ngx_string("fastcgi_script_name"); 
     414static ngx_http_variable_t  ngx_http_fastcgi_vars[] = { 
     415 
     416    { ngx_string("fastcgi_script_name"), NULL, 
     417      ngx_http_fastcgi_script_name_variable, 0, 
     418      NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, 
     419 
     420    { ngx_string("fastcgi_path_info"), NULL, 
     421      ngx_http_fastcgi_path_info_variable, 0, 
     422      NGX_HTTP_VAR_NOCACHEABLE|NGX_HTTP_VAR_NOHASH, 0 }, 
     423 
     424    { ngx_null_string, NULL, NULL, 0, 0, 0 } 
     425}; 
    395426 
    396427 
     
    411442    ngx_int_t                     rc; 
    412443    ngx_http_upstream_t          *u; 
     444    ngx_http_fastcgi_ctx_t       *f; 
    413445    ngx_http_fastcgi_loc_conf_t  *flcf; 
    414446 
     
    420452    } 
    421453 
    422     ngx_http_set_ctx(r, NULL, ngx_http_fastcgi_module); 
     454    f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t)); 
     455    if (f == NULL) { 
     456        return NGX_ERROR; 
     457    } 
     458 
     459    ngx_http_set_ctx(r, f, ngx_http_fastcgi_module); 
    423460 
    424461    u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); 
     
    934971    umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); 
    935972 
    936     if (f == NULL) { 
    937         f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t)); 
    938         if (f == NULL) { 
    939             return NGX_ERROR; 
    940         } 
    941  
    942         ngx_http_set_ctx(r, f, ngx_http_fastcgi_module); 
    943     } 
    944  
    945973    u = r->upstream; 
    946974 
     
    16671695ngx_http_fastcgi_add_variables(ngx_conf_t *cf) 
    16681696{ 
    1669     ngx_http_variable_t  *var; 
    1670  
    1671     var = ngx_http_add_variable(cf, &ngx_http_fastcgi_script_name, 
    1672                                 NGX_HTTP_VAR_NOHASH|NGX_HTTP_VAR_NOCACHEABLE); 
    1673     if (var == NULL) { 
    1674         return NGX_ERROR; 
    1675     } 
    1676  
    1677     var->get_handler = ngx_http_fastcgi_script_name_variable; 
     1697   ngx_http_variable_t  *var, *v; 
     1698 
     1699    for (v = ngx_http_fastcgi_vars; v->name.len; v++) { 
     1700        var = ngx_http_add_variable(cf, &v->name, v->flags); 
     1701        if (var == NULL) { 
     1702            return NGX_ERROR; 
     1703        } 
     1704 
     1705        var->get_handler = v->get_handler; 
     1706        var->data = v->data; 
     1707    } 
    16781708 
    16791709    return NGX_OK; 
     
    19341964    } 
    19351965 
     1966#if (NGX_PCRE) 
     1967    if (conf->split_regex == NULL) { 
     1968        conf->split_regex = prev->split_regex; 
     1969        conf->split_name = prev->split_name; 
     1970    } 
     1971#endif 
     1972 
    19361973    if (conf->params_source == NULL) { 
    19371974        conf->flushes = prev->flushes; 
     
    20722109{ 
    20732110    u_char                       *p; 
     2111    ngx_http_fastcgi_ctx_t       *f; 
    20742112    ngx_http_fastcgi_loc_conf_t  *flcf; 
    20752113 
    2076     if (r->uri.len) { 
     2114    f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module); 
     2115    flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); 
     2116 
     2117    if (ngx_http_fastcgi_split(r, f, flcf) != NGX_OK) { 
     2118        return NGX_ERROR; 
     2119    } 
     2120 
     2121    if (f->script_name.len == 0 
     2122        || f->script_name.data[f->script_name.len - 1] != '/') 
     2123    { 
     2124        v->len = f->script_name.len; 
    20772125        v->valid = 1; 
    20782126        v->no_cacheable = 0; 
    20792127        v->not_found = 0; 
    2080  
    2081         flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); 
    2082  
    2083         if (r->uri.data[r->uri.len - 1] != '/') { 
    2084             v->len = r->uri.len; 
    2085             v->data = r->uri.data; 
    2086             return NGX_OK; 
    2087         } 
    2088  
    2089         v->len = r->uri.len + flcf->index.len; 
    2090  
    2091         v->data = ngx_pnalloc(r->pool, v->len); 
    2092         if (v->data == NULL) { 
    2093             return NGX_ERROR; 
    2094         } 
    2095  
    2096         p = ngx_copy(v->data, r->uri.data, r->uri.len); 
    2097         ngx_memcpy(p, flcf->index.data, flcf->index.len); 
    2098  
    2099     } else { 
    2100         v->len = 0; 
    2101         v->valid = 1; 
    2102         v->no_cacheable = 0; 
    2103         v->not_found = 0; 
    2104         v->data = NULL; 
     2128        v->data = f->script_name.data; 
    21052129 
    21062130        return NGX_OK; 
    21072131    } 
    21082132 
     2133    v->len = f->script_name.len + flcf->index.len; 
     2134 
     2135    v->data = ngx_pnalloc(r->pool, v->len); 
     2136    if (v->data == NULL) { 
     2137        return NGX_ERROR; 
     2138    } 
     2139 
     2140    p = ngx_copy(v->data, f->script_name.data, f->script_name.len); 
     2141    ngx_memcpy(p, flcf->index.data, flcf->index.len); 
     2142 
    21092143    return NGX_OK; 
     2144} 
     2145 
     2146 
     2147static ngx_int_t 
     2148ngx_http_fastcgi_path_info_variable(ngx_http_request_t *r, 
     2149    ngx_http_variable_value_t *v, uintptr_t data) 
     2150{ 
     2151    ngx_http_fastcgi_ctx_t       *f; 
     2152    ngx_http_fastcgi_loc_conf_t  *flcf; 
     2153 
     2154    f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module); 
     2155    flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); 
     2156 
     2157    if (ngx_http_fastcgi_split(r, f, flcf) != NGX_OK) { 
     2158        return NGX_ERROR; 
     2159    } 
     2160 
     2161    v->len = f->path_info.len; 
     2162    v->valid = 1; 
     2163    v->no_cacheable = 0; 
     2164    v->not_found = 0; 
     2165    v->data = f->path_info.data; 
     2166 
     2167    return NGX_OK; 
     2168} 
     2169 
     2170 
     2171static ngx_int_t 
     2172ngx_http_fastcgi_split(ngx_http_request_t *r, ngx_http_fastcgi_ctx_t *f, 
     2173    ngx_http_fastcgi_loc_conf_t *flcf) 
     2174{ 
     2175#if (NGX_PCRE) 
     2176    ngx_int_t  n; 
     2177    int        captures[(1 + 2) * 3]; 
     2178 
     2179    if (f->script_name.len) { 
     2180        return NGX_OK; 
     2181    } 
     2182 
     2183    if (flcf->split_regex == NULL) { 
     2184        f->script_name = r->uri; 
     2185        return NGX_OK; 
     2186    } 
     2187 
     2188    n = ngx_regex_exec(flcf->split_regex, &r->uri, captures, (1 + 2) * 3); 
     2189 
     2190    if (n == NGX_REGEX_NO_MATCHED) { 
     2191        f->script_name = r->uri; 
     2192        return NGX_OK; 
     2193    } 
     2194 
     2195    if (n < 0) { 
     2196        ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 
     2197                      ngx_regex_exec_n " failed: %d on \"%V\" using \"%V\"", 
     2198                      n, &r->uri, &flcf->split_name); 
     2199        return NGX_ERROR; 
     2200    } 
     2201 
     2202    /* match */ 
     2203 
     2204    f->script_name.len = captures[3] - captures[2]; 
     2205    f->script_name.data = r->uri.data; 
     2206 
     2207    f->path_info.len = captures[5] - captures[4]; 
     2208    f->path_info.data = r->uri.data + f->script_name.len; 
     2209 
     2210    return NGX_OK; 
     2211 
     2212#else 
     2213 
     2214    f->script_name = r->uri; 
     2215 
     2216    return NGX_OK; 
     2217 
     2218#endif 
    21102219} 
    21112220 
     
    21692278 
    21702279    return NGX_CONF_OK; 
     2280} 
     2281 
     2282 
     2283static char * 
     2284ngx_http_fastcgi_split_path_info(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 
     2285{ 
     2286#if (NGX_PCRE) 
     2287    ngx_http_fastcgi_loc_conf_t *flcf = conf; 
     2288 
     2289    ngx_int_t   n; 
     2290    ngx_str_t  *value, err; 
     2291    u_char      errstr[NGX_MAX_CONF_ERRSTR]; 
     2292 
     2293    value = cf->args->elts; 
     2294 
     2295    flcf->split_name = value[1]; 
     2296 
     2297    err.len = NGX_MAX_CONF_ERRSTR; 
     2298    err.data = errstr; 
     2299 
     2300    flcf->split_regex = ngx_regex_compile(&value[1], 0, cf->pool, &err); 
     2301 
     2302    if (flcf->split_regex == NULL) { 
     2303        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", err.data); 
     2304        return NGX_CONF_ERROR; 
     2305    } 
     2306 
     2307    n = ngx_regex_capture_count(flcf->split_regex); 
     2308 
     2309    if (n < 0) { 
     2310        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 
     2311                           ngx_regex_capture_count_n " failed for " 
     2312                           "pattern \"%V\"", &value[1]); 
     2313        return NGX_CONF_ERROR; 
     2314    } 
     2315 
     2316    if (n != 2) { 
     2317        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 
     2318                           "pattern \"%V\" must have 2 captures", &value[1]); 
     2319        return NGX_CONF_ERROR; 
     2320    } 
     2321 
     2322    return NGX_CONF_OK; 
     2323 
     2324#else 
     2325 
     2326    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 
     2327                       "\"%V\" requires PCRE library", &cmd->name); 
     2328    return NGX_CONF_ERROR; 
     2329 
     2330#endif 
    21712331} 
    21722332 
  • server/src/http/modules/ngx_http_flv_module.c

    ra90ad7 re7b311  
    161161    } 
    162162 
    163     r->root_tested = 1; 
     163    r->root_tested = !r->error_page; 
    164164 
    165165    start = 0; 
  • server/src/http/modules/ngx_http_geo_module.c

    rb82943 re7b311  
    519519    ngx_http_geo_range_t  *range; 
    520520 
    521     for (n = start; n < end; n += 0x10000) { 
     521    for (n = start; n <= end; n += 0x10000) { 
    522522 
    523523        h = n >> 16; 
    524         s = n & 0xffff; 
     524 
     525        if (n == start) { 
     526            s = n & 0xffff; 
     527        } else { 
     528            s = 0; 
     529        } 
    525530 
    526531        if ((n | 0xffff) > end) { 
     
    568573                           (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); 
    569574 
    570                 range = &range[i + 1]; 
     575                range[i + 1].start = (u_short) s; 
     576                range[i + 1].end = (u_short) e; 
     577                range[i + 1].value = ctx->value; 
    571578 
    572579                goto next; 
     
    579586                    "duplicate range \"%V\", value: \"%v\", old value: \"%v\"", 
    580587                    ctx->net, ctx->value, range[i].value); 
    581                 continue; 
    582             } 
     588 
     589                range[i].value = ctx->value; 
     590 
     591                goto next; 
     592            } 
     593 
     594            if (s > (ngx_uint_t) range[i].start 
     595                && e < (ngx_uint_t) range[i].end) 
     596            { 
     597                /* split the range and insert the new one */ 
     598 
     599                range = ngx_array_push(a); 
     600                if (range == NULL) { 
     601                    return NGX_CONF_ERROR; 
     602                } 
     603 
     604                range = ngx_array_push(a); 
     605                if (range == NULL) { 
     606                    return NGX_CONF_ERROR; 
     607                } 
     608 
     609                range = a->elts; 
     610 
     611                ngx_memcpy(&range[i + 3], &range[i + 1], 
     612                           (a->nelts - 3 - i) * sizeof(ngx_http_geo_range_t)); 
     613 
     614                range[i + 2].start = (u_short) (e + 1); 
     615                range[i + 2].end = range[i].end; 
     616                range[i + 2].value = range[i].value; 
     617 
     618                range[i + 1].start = (u_short) s; 
     619                range[i + 1].end = (u_short) e; 
     620                range[i + 1].value = ctx->value; 
     621 
     622                range[i].end = (u_short) (s - 1); 
     623 
     624                goto next; 
     625            } 
     626 
     627            if (s == (ngx_uint_t) range[i].start 
     628                && e < (ngx_uint_t) range[i].end) 
     629            { 
     630                /* shift the range start and insert the new range */ 
     631 
     632                range = ngx_array_push(a); 
     633                if (range == NULL) { 
     634                    return NGX_CONF_ERROR; 
     635                } 
     636 
     637                range = a->elts; 
     638 
     639                ngx_memcpy(&range[i + 2], &range[i + 1], 
     640                           (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); 
     641 
     642                range[i + 1].start = (u_short) (e + 1); 
     643 
     644                range[i].start = (u_short) s; 
     645                range[i].end = (u_short) e; 
     646                range[i].value = ctx->value; 
     647 
     648                goto next; 
     649            } 
     650 
     651            if (s > (ngx_uint_t) range[i].start 
     652                && e == (ngx_uint_t) range[i].end) 
     653            { 
     654                /* shift the range end and insert the new range */ 
     655 
     656                range = ngx_array_push(a); 
     657                if (range == NULL) { 
     658                    return NGX_CONF_ERROR; 
     659                } 
     660 
     661                range = a->elts; 
     662 
     663                ngx_memcpy(&range[i + 2], &range[i + 1], 
     664                           (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); 
     665 
     666                range[i + 1].start = (u_short) s; 
     667                range[i + 1].end = (u_short) e; 
     668                range[i + 1].value = ctx->value; 
     669 
     670                range[i].end = (u_short) (s - 1); 
     671 
     672                goto next; 
     673            } 
     674 
     675            s = (ngx_uint_t) range[i].start; 
     676            e = (ngx_uint_t) range[i].end; 
    583677 
    584678            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 
    585                                "overlapped range \"%V\"", ctx->net); 
     679                         "range \"%V\" overlaps \"%d.%d.%d.%d-%d.%d.%d.%d\"", 
     680                         ctx->net, 
     681                         h >> 8, h & 0xff, s >> 8, s & 0xff, 
     682                         h >> 8, h & 0xff, e >> 8, e & 0xff); 
    586683 
    587684            return NGX_CONF_ERROR; 
     
    595692        } 
    596693 
    597     next: 
    598  
    599694        range->start = (u_short) s; 
    600695        range->end = (u_short) e; 
    601696        range->value = ctx->value; 
     697 
     698    next: 
     699 
     700        continue; 
    602701    } 
    603702 
     
    617716    warn = 0; 
    618717 
    619     for (n = start; n < end; n += 0x10000) { 
     718    for (n = start; n <= end; n += 0x10000) { 
    620719 
    621720        h = n >> 16; 
    622         s = n & 0xffff; 
     721 
     722        if (n == start) { 
     723            s = n & 0xffff; 
     724        } else { 
     725            s = 0; 
     726        } 
    623727 
    624728        if ((n | 0xffff) > end) { 
     
    644748                ngx_memcpy(&range[i], &range[i + 1], 
    645749                           (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t)); 
     750 
     751                a->nelts--; 
     752 
    646753                break; 
    647754            } 
  • server/src/http/modules/ngx_http_gzip_static_module.c

    r2edd9f re7b311  
    177177#endif 
    178178 
    179     r->root_tested = 1; 
     179    r->root_tested = !r->error_page; 
    180180 
    181181    rc = ngx_http_discard_request_body(r); 
  • server/src/http/modules/ngx_http_static_module.c

    rb82943 re7b311  
    136136    } 
    137137 
    138     r->root_tested = 1; 
     138    r->root_tested = !r->error_page; 
    139139 
    140140    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd); 
  • server/src/http/modules/perl/nginx.pm

    r2240a4 re7b311  
    4848); 
    4949 
    50 our $VERSION = '0.7.30'; 
     50our $VERSION = '0.7.31'; 
    5151 
    5252require XSLoader; 
  • server/src/http/ngx_http_core_module.c

    r814e69 re7b311  
    2424static ngx_int_t ngx_http_core_find_static_location(ngx_http_request_t *r, 
    2525    ngx_http_location_tree_node_t *node); 
    26 static ngx_int_t ngx_http_core_send_continue(ngx_http_request_t *r); 
    2726 
    2827static ngx_int_t ngx_http_core_preconfiguration(ngx_conf_t *cf); 
     
    819818    u_char                    *p; 
    820819    size_t                     len; 
    821     ngx_int_t                  rc, expect; 
     820    ngx_int_t                  rc; 
    822821    ngx_http_core_loc_conf_t  *clcf; 
    823822 
     
    861860        ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE); 
    862861        return NGX_OK; 
    863     } 
    864  
    865     if (r->headers_in.expect && r->http_version > NGX_HTTP_VERSION_10) { 
    866         expect = ngx_http_core_send_continue(r); 
    867  
    868         if (expect != NGX_OK) { 
    869             ngx_http_finalize_request(r, expect); 
    870             return NGX_OK; 
    871         } 
    872862    } 
    873863 
     
    11831173        } 
    11841174 
     1175        if (!of.is_file) { 
     1176            continue; 
     1177        } 
     1178 
    11851179        path.len -= root; 
    11861180        path.data += root; 
     
    14911485 
    14921486 
    1493 static ngx_int_t 
    1494 ngx_http_core_send_continue(ngx_http_request_t *r) 
    1495 { 
    1496     ngx_int_t   n; 
    1497     ngx_str_t  *expect; 
    1498  
    1499     if (r->expect_tested) { 
    1500         return NGX_OK; 
    1501     } 
    1502  
    1503     r->expect_tested = 1; 
    1504  
    1505     expect = &r->headers_in.expect->value; 
    1506  
    1507     if (expect->len != sizeof("100-continue") - 1 
    1508         || ngx_strncasecmp(expect->data, (u_char *) "100-continue", 
    1509                            sizeof("100-continue") - 1) 
    1510            != 0) 
    1511     { 
    1512         return NGX_OK; 
    1513     } 
    1514  
    1515     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
    1516                    "send 100 Continue"); 
    1517  
    1518     n = r->connection->send(r->connection, 
    1519                             (u_char *) "HTTP/1.1 100 Continue" CRLF CRLF, 
    1520                             sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1); 
    1521  
    1522     if (n == sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1) { 
    1523         return NGX_OK; 
    1524     } 
    1525  
    1526     /* we assume that such small packet should be send successfully */ 
    1527  
    1528     return NGX_HTTP_INTERNAL_SERVER_ERROR; 
    1529 } 
    1530  
    1531  
    15321487void * 
    15331488ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash) 
     
    21262081 
    21272082    sr->discard_body = r->discard_body; 
     2083    sr->expect_tested = 1; 
    21282084    sr->main_filter_need_in_memory = r->main_filter_need_in_memory; 
    21292085 
  • server/src/http/ngx_http_request_body.c

    rb82943 re7b311  
    1616static void ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r); 
    1717static ngx_int_t ngx_http_read_discarded_request_body(ngx_http_request_t *r); 
     18static ngx_int_t ngx_http_test_expect(ngx_http_request_t *r); 
    1819 
    1920 
     
    4041        post_handler(r); 
    4142        return NGX_OK; 
     43    } 
     44 
     45    if (ngx_http_test_expect(r) != NGX_OK) { 
     46        return NGX_HTTP_INTERNAL_SERVER_ERROR; 
    4247    } 
    4348 
     
    434439    } 
    435440 
     441    if (ngx_http_test_expect(r) != NGX_OK) { 
     442        return NGX_HTTP_INTERNAL_SERVER_ERROR; 
     443    } 
     444 
    436445    rev = r->connection->read; 
    437446 
     
    582591    return NGX_AGAIN; 
    583592} 
     593 
     594 
     595static ngx_int_t 
     596ngx_http_test_expect(ngx_http_request_t *r) 
     597{ 
     598    ngx_int_t   n; 
     599    ngx_str_t  *expect; 
     600 
     601    if (r->expect_tested 
     602        || r->headers_in.expect == NULL 
     603        || r->http_version < NGX_HTTP_VERSION_11) 
     604    { 
     605        return NGX_OK; 
     606    } 
     607 
     608    r->expect_tested = 1; 
     609 
     610    expect = &r->headers_in.expect->value; 
     611 
     612    if (expect->len != sizeof("100-continue") - 1 
     613        || ngx_strncasecmp(expect->data, (u_char *) "100-continue", 
     614                           sizeof("100-continue") - 1) 
     615           != 0) 
     616    { 
     617        return NGX_OK; 
     618    } 
     619 
     620    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 
     621                   "send 100 Continue"); 
     622 
     623    n = r->connection->send(r->connection, 
     624                            (u_char *) "HTTP/1.1 100 Continue" CRLF CRLF, 
     625                            sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1); 
     626 
     627    if (n == sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1) { 
     628        return NGX_OK; 
     629    } 
     630 
     631    /* we assume that such small packet should be send successfully */ 
     632 
     633    return NGX_ERROR; 
     634} 
  • server/src/http/ngx_http_special_response.c

    r8f5df0 re7b311  
    380380    } 
    381381 
     382    r->expect_tested = 1; 
     383 
    382384    if (ngx_http_discard_request_body(r) != NGX_OK) { 
    383385        error = NGX_HTTP_INTERNAL_SERVER_ERROR; 
     
    432434{ 
    433435    u_char                     ch, *p, *last; 
     436    ngx_int_t                  overwrite; 
    434437    ngx_str_t                 *uri, *args, u, a; 
    435438    ngx_table_elt_t           *location; 
    436439    ngx_http_core_loc_conf_t  *clcf; 
    437440 
    438     r->err_status = err_page->overwrite; 
     441    overwrite = err_page->overwrite; 
     442 
     443    if (overwrite && overwrite != NGX_HTTP_OK) { 
     444        r->expect_tested = 1; 
     445    } 
     446 
     447    r->err_status = overwrite; 
    439448 
    440449    r->zero_in_uri = 0; 
  • server/src/http/ngx_http_upstream.c

    r814e69 re7b311  
    14421442        } 
    14431443 
    1444         if (status == NGX_HTTP_NOT_FOUND && u->conf->intercept_404) { 
    1445             ngx_http_upstream_finalize_request(r, u, NGX_HTTP_NOT_FOUND); 
    1446             return NGX_OK; 
    1447         } 
    1448  
    14491444#if (NGX_HTTP_CACHE) 
    14501445 
     
    14721467    ngx_http_core_loc_conf_t  *clcf; 
    14731468 
     1469    status = u->headers_in.status_n; 
     1470 
     1471    if (status == NGX_HTTP_NOT_FOUND && u->conf->intercept_404) { 
     1472        ngx_http_upstream_finalize_request(r, u, NGX_HTTP_NOT_FOUND); 
     1473        return NGX_OK; 
     1474    } 
     1475 
    14741476    if (!u->conf->intercept_errors) { 
    14751477        return NGX_DECLINED; 
     
    14811483        return NGX_DECLINED; 
    14821484    } 
    1483  
    1484     status = u->headers_in.status_n; 
    14851485 
    14861486    err_page = clcf->error_pages->elts; 
     
    22022202ngx_http_upstream_process_request(ngx_http_request_t *r) 
    22032203{ 
     2204    ngx_uint_t            del; 
    22042205    ngx_temp_file_t      *tf; 
    22052206    ngx_event_pipe_t     *p; 
     
    22132214        if (u->store) { 
    22142215 
     2216            del = p->upstream_error; 
     2217 
    22152218            tf = u->pipe->temp_file; 
    22162219 
    2217             if (p->upstream_eof 
    2218                 && u->headers_in.status_n == NGX_HTTP_OK 
    2219                 && (u->headers_in.content_length_n == -1 
    2220                     || (u->headers_in.content_length_n == tf->offset))) 
    2221             { 
    2222                 ngx_http_upstream_store(r, u); 
    2223  
    2224             } else if ((p->upstream_error 
    2225                         || (p->upstream_eof 
    2226                             && u->headers_in.status_n != NGX_HTTP_OK)) 
    2227                        && tf->file.fd != NGX_INVALID_FILE) 
    2228             { 
     2220            if (p->upstream_eof) { 
     2221 
     2222                if (u->headers_in.status_n == NGX_HTTP_OK 
     2223                    && (u->headers_in.content_length_n == -1 
     2224                        || (u->headers_in.content_length_n == tf->offset))) 
     2225                { 
     2226                    ngx_http_upstream_store(r, u); 
     2227 
     2228                } else { 
     2229                    del = 1; 
     2230                } 
     2231            } 
     2232 
     2233            if (del && tf->file.fd != NGX_INVALID_FILE) { 
     2234 
    22292235                if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { 
    22302236 
  • server/src/mail/ngx_mail_proxy_module.c

    rb82943 re7b311  
    105105 
    106106 
    107 static u_char  smtp_ok[] = "250 2.0.0 OK" CRLF; 
     107static u_char  smtp_auth_ok[] = "235 2.0.0 OK" CRLF; 
    108108 
    109109 
     
    615615 
    616616        } else { 
    617             ngx_memcpy(b->start, smtp_ok, sizeof(smtp_ok) - 1); 
    618             b->last = b->start + sizeof(smtp_ok) - 1; 
     617            ngx_memcpy(b->start, smtp_auth_ok, sizeof(smtp_auth_ok) - 1); 
     618            b->last = b->start + sizeof(smtp_auth_ok) - 1; 
    619619        } 
    620620 
  • server/src/os/unix/ngx_posix_init.c

    rb57b1b re7b311  
    2323    ngx_readv_chain, 
    2424    ngx_udp_unix_recv, 
    25     NULL, 
     25    ngx_unix_send, 
    2626    ngx_writev_chain, 
    2727    0 
Note: See TracChangeset for help on using the changeset viewer.