Changeset e7b311
- Timestamp:
- 02/03/09 19:41:37 (3 years ago)
- 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)
- Location:
- server
- Files:
-
- 19 edited
-
CHANGES (modified) (1 diff)
-
CHANGES.ru (modified) (1 diff)
-
LICENSE (modified) (2 diffs)
-
src/core/nginx.h (modified) (1 diff)
-
src/core/ngx_cycle.c (modified) (1 diff)
-
src/core/ngx_log.c (modified) (1 diff)
-
src/core/ngx_slab.c (modified) (1 diff)
-
src/http/modules/ngx_http_fastcgi_module.c (modified) (12 diffs)
-
src/http/modules/ngx_http_flv_module.c (modified) (1 diff)
-
src/http/modules/ngx_http_geo_module.c (modified) (6 diffs)
-
src/http/modules/ngx_http_gzip_static_module.c (modified) (1 diff)
-
src/http/modules/ngx_http_static_module.c (modified) (1 diff)
-
src/http/modules/perl/nginx.pm (modified) (1 diff)
-
src/http/ngx_http_core_module.c (modified) (6 diffs)
-
src/http/ngx_http_request_body.c (modified) (4 diffs)
-
src/http/ngx_http_special_response.c (modified) (2 diffs)
-
src/http/ngx_http_upstream.c (modified) (5 diffs)
-
src/mail/ngx_mail_proxy_module.c (modified) (2 diffs)
-
src/os/unix/ngx_posix_init.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
server/CHANGES
r2240a4 re7b311 1 2 Changes 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 1 22 2 23 Changes with nginx 0.7.30 24 Dec 2008 3 24 4 25 *) 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. 8 28 9 29 -
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 1 22 2 23 éÚÍÅÎÅÎÉÑ × nginx 0.7.30 24.12.2008 3 24 4 25 *) éÓÐÒÁ×ÌÅÎÉÅ: × ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÐÒÏÉÓÈÏÄÉÌ segmentation fault, ÅÓÌÉ 5 × ÄÉÒÅËÔÉ×ÁÈ fastcgi_pass É proxy_pass ÉÓÐÏÌØÚÏ×ÁÌÉÓØ ÐÅÒÅÍÅÎÎÙÅ É26 × ÄÉÒÅËÔÉ×ÁÈ fastcgi_pass ÉÌÉ proxy_pass ÉÓÐÏÌØÚÏ×ÁÌÉÓØ ÐÅÒÅÍÅÎÎÙÅ É 6 27 ÉÍÑ ÈÏÓÔÁ ÄÏÌÖÎÏ ÂÙÌÏ ÒÅÚÏÌ×ÉÔØÓÑ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.29. 7 28 -
server/LICENSE
rcef790 re7b311 1 1 /* 2 * Copyright (C) 2002-200 8Igor Sysoev2 * Copyright (C) 2002-2009 Igor Sysoev 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 22 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 23 * SUCH DAMAGE. 24 *25 24 */ -
server/src/core/nginx.h
r2240a4 re7b311 9 9 10 10 11 #define NGINX_VERSION "0.7.3 0"11 #define NGINX_VERSION "0.7.31" 12 12 #define NGINX_VER "nginx/" NGINX_VERSION 13 13 -
server/src/core/ngx_cycle.c
r0f43eb re7b311 395 395 pool->log = cycle->new_log; 396 396 397 if (cycle->log->log_level == 0) {398 cycle->log->log_level = NGX_LOG_ERR;399 }400 401 397 402 398 /* create shared memory */ -
server/src/core/ngx_log.c
rb82943 re7b311 303 303 } 304 304 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) { 306 309 log->log_level = NGX_LOG_DEBUG_ALL; 307 310 } -
server/src/core/ngx_slab.c
r08686b re7b311 686 686 687 687 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, NGX_ENOMEM, 688 "ngx_slab_alloc(): failed");688 "ngx_slab_alloc(): failed"); 689 689 690 690 return NULL; -
server/src/http/modules/ngx_http_fastcgi_module.c
r2240a4 re7b311 23 23 ngx_array_t *fastcgi_lengths; 24 24 ngx_array_t *fastcgi_values; 25 26 #if (NGX_PCRE) 27 ngx_regex_t *split_regex; 28 ngx_str_t split_name; 29 #endif 25 30 } ngx_http_fastcgi_loc_conf_t; 26 31 … … 57 62 58 63 ngx_array_t *split_parts; 64 65 ngx_str_t script_name; 66 ngx_str_t path_info; 59 67 } ngx_http_fastcgi_ctx_t; 60 68 … … 126 134 static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, 127 135 ngx_http_variable_value_t *v, uintptr_t data); 136 static ngx_int_t ngx_http_fastcgi_path_info_variable(ngx_http_request_t *r, 137 ngx_http_variable_value_t *v, uintptr_t data); 138 static 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); 128 140 129 141 static char *ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, 130 142 void *conf); 143 static char *ngx_http_fastcgi_split_path_info(ngx_conf_t *cf, 144 ngx_command_t *cmd, void *conf); 131 145 static char *ngx_http_fastcgi_store(ngx_conf_t *cf, ngx_command_t *cmd, 132 146 void *conf); … … 170 184 NGX_HTTP_LOC_CONF_OFFSET, 171 185 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, 172 193 NULL }, 173 194 … … 391 412 392 413 393 static ngx_str_t ngx_http_fastcgi_script_name = 394 ngx_string("fastcgi_script_name"); 414 static 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 }; 395 426 396 427 … … 411 442 ngx_int_t rc; 412 443 ngx_http_upstream_t *u; 444 ngx_http_fastcgi_ctx_t *f; 413 445 ngx_http_fastcgi_loc_conf_t *flcf; 414 446 … … 420 452 } 421 453 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); 423 460 424 461 u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); … … 934 971 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); 935 972 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 945 973 u = r->upstream; 946 974 … … 1667 1695 ngx_http_fastcgi_add_variables(ngx_conf_t *cf) 1668 1696 { 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 } 1678 1708 1679 1709 return NGX_OK; … … 1934 1964 } 1935 1965 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 1936 1973 if (conf->params_source == NULL) { 1937 1974 conf->flushes = prev->flushes; … … 2072 2109 { 2073 2110 u_char *p; 2111 ngx_http_fastcgi_ctx_t *f; 2074 2112 ngx_http_fastcgi_loc_conf_t *flcf; 2075 2113 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; 2077 2125 v->valid = 1; 2078 2126 v->no_cacheable = 0; 2079 2127 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; 2105 2129 2106 2130 return NGX_OK; 2107 2131 } 2108 2132 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 2109 2143 return NGX_OK; 2144 } 2145 2146 2147 static ngx_int_t 2148 ngx_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 2171 static ngx_int_t 2172 ngx_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 2110 2219 } 2111 2220 … … 2169 2278 2170 2279 return NGX_CONF_OK; 2280 } 2281 2282 2283 static char * 2284 ngx_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 2171 2331 } 2172 2332 -
server/src/http/modules/ngx_http_flv_module.c
ra90ad7 re7b311 161 161 } 162 162 163 r->root_tested = 1;163 r->root_tested = !r->error_page; 164 164 165 165 start = 0; -
server/src/http/modules/ngx_http_geo_module.c
rb82943 re7b311 519 519 ngx_http_geo_range_t *range; 520 520 521 for (n = start; n < end; n += 0x10000) {521 for (n = start; n <= end; n += 0x10000) { 522 522 523 523 h = n >> 16; 524 s = n & 0xffff; 524 525 if (n == start) { 526 s = n & 0xffff; 527 } else { 528 s = 0; 529 } 525 530 526 531 if ((n | 0xffff) > end) { … … 568 573 (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); 569 574 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; 571 578 572 579 goto next; … … 579 586 "duplicate range \"%V\", value: \"%v\", old value: \"%v\"", 580 587 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; 583 677 584 678 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); 586 683 587 684 return NGX_CONF_ERROR; … … 595 692 } 596 693 597 next:598 599 694 range->start = (u_short) s; 600 695 range->end = (u_short) e; 601 696 range->value = ctx->value; 697 698 next: 699 700 continue; 602 701 } 603 702 … … 617 716 warn = 0; 618 717 619 for (n = start; n < end; n += 0x10000) {718 for (n = start; n <= end; n += 0x10000) { 620 719 621 720 h = n >> 16; 622 s = n & 0xffff; 721 722 if (n == start) { 723 s = n & 0xffff; 724 } else { 725 s = 0; 726 } 623 727 624 728 if ((n | 0xffff) > end) { … … 644 748 ngx_memcpy(&range[i], &range[i + 1], 645 749 (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t)); 750 751 a->nelts--; 752 646 753 break; 647 754 } -
server/src/http/modules/ngx_http_gzip_static_module.c
r2edd9f re7b311 177 177 #endif 178 178 179 r->root_tested = 1;179 r->root_tested = !r->error_page; 180 180 181 181 rc = ngx_http_discard_request_body(r); -
server/src/http/modules/ngx_http_static_module.c
rb82943 re7b311 136 136 } 137 137 138 r->root_tested = 1;138 r->root_tested = !r->error_page; 139 139 140 140 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd); -
server/src/http/modules/perl/nginx.pm
r2240a4 re7b311 48 48 ); 49 49 50 our $VERSION = '0.7.3 0';50 our $VERSION = '0.7.31'; 51 51 52 52 require XSLoader; -
server/src/http/ngx_http_core_module.c
r814e69 re7b311 24 24 static ngx_int_t ngx_http_core_find_static_location(ngx_http_request_t *r, 25 25 ngx_http_location_tree_node_t *node); 26 static ngx_int_t ngx_http_core_send_continue(ngx_http_request_t *r);27 26 28 27 static ngx_int_t ngx_http_core_preconfiguration(ngx_conf_t *cf); … … 819 818 u_char *p; 820 819 size_t len; 821 ngx_int_t rc , expect;820 ngx_int_t rc; 822 821 ngx_http_core_loc_conf_t *clcf; 823 822 … … 861 860 ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE); 862 861 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 }872 862 } 873 863 … … 1183 1173 } 1184 1174 1175 if (!of.is_file) { 1176 continue; 1177 } 1178 1185 1179 path.len -= root; 1186 1180 path.data += root; … … 1491 1485 1492 1486 1493 static ngx_int_t1494 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") - 11508 || 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 1532 1487 void * 1533 1488 ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash) … … 2126 2081 2127 2082 sr->discard_body = r->discard_body; 2083 sr->expect_tested = 1; 2128 2084 sr->main_filter_need_in_memory = r->main_filter_need_in_memory; 2129 2085 -
server/src/http/ngx_http_request_body.c
rb82943 re7b311 16 16 static void ngx_http_read_discarded_request_body_handler(ngx_http_request_t *r); 17 17 static ngx_int_t ngx_http_read_discarded_request_body(ngx_http_request_t *r); 18 static ngx_int_t ngx_http_test_expect(ngx_http_request_t *r); 18 19 19 20 … … 40 41 post_handler(r); 41 42 return NGX_OK; 43 } 44 45 if (ngx_http_test_expect(r) != NGX_OK) { 46 return NGX_HTTP_INTERNAL_SERVER_ERROR; 42 47 } 43 48 … … 434 439 } 435 440 441 if (ngx_http_test_expect(r) != NGX_OK) { 442 return NGX_HTTP_INTERNAL_SERVER_ERROR; 443 } 444 436 445 rev = r->connection->read; 437 446 … … 582 591 return NGX_AGAIN; 583 592 } 593 594 595 static ngx_int_t 596 ngx_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 380 380 } 381 381 382 r->expect_tested = 1; 383 382 384 if (ngx_http_discard_request_body(r) != NGX_OK) { 383 385 error = NGX_HTTP_INTERNAL_SERVER_ERROR; … … 432 434 { 433 435 u_char ch, *p, *last; 436 ngx_int_t overwrite; 434 437 ngx_str_t *uri, *args, u, a; 435 438 ngx_table_elt_t *location; 436 439 ngx_http_core_loc_conf_t *clcf; 437 440 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; 439 448 440 449 r->zero_in_uri = 0; -
server/src/http/ngx_http_upstream.c
r814e69 re7b311 1442 1442 } 1443 1443 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 1449 1444 #if (NGX_HTTP_CACHE) 1450 1445 … … 1472 1467 ngx_http_core_loc_conf_t *clcf; 1473 1468 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 1474 1476 if (!u->conf->intercept_errors) { 1475 1477 return NGX_DECLINED; … … 1481 1483 return NGX_DECLINED; 1482 1484 } 1483 1484 status = u->headers_in.status_n;1485 1485 1486 1486 err_page = clcf->error_pages->elts; … … 2202 2202 ngx_http_upstream_process_request(ngx_http_request_t *r) 2203 2203 { 2204 ngx_uint_t del; 2204 2205 ngx_temp_file_t *tf; 2205 2206 ngx_event_pipe_t *p; … … 2213 2214 if (u->store) { 2214 2215 2216 del = p->upstream_error; 2217 2215 2218 tf = u->pipe->temp_file; 2216 2219 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 2229 2235 if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) { 2230 2236 -
server/src/mail/ngx_mail_proxy_module.c
rb82943 re7b311 105 105 106 106 107 static u_char smtp_ ok[] = "2502.0.0 OK" CRLF;107 static u_char smtp_auth_ok[] = "235 2.0.0 OK" CRLF; 108 108 109 109 … … 615 615 616 616 } 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; 619 619 } 620 620 -
server/src/os/unix/ngx_posix_init.c
rb57b1b re7b311 23 23 ngx_readv_chain, 24 24 ngx_udp_unix_recv, 25 NULL,25 ngx_unix_send, 26 26 ngx_writev_chain, 27 27 0
Note: See TracChangeset
for help on using the changeset viewer.
