comparison src/http/ngx_http_core_module.c @ 126:df17fbafec8f NGINX_0_3_10

nginx 0.3.10 *) Change: the "valid_referers" directive and the "$invalid_referer" variable were moved to the new ngx_http_referer_module from the ngx_http_rewrite_module. *) Change: the "$apache_bytes_sent" variable name was changed to "$body_bytes_sent". *) Feature: the "$sent_http_..." variables. *) Feature: the "if" directive supports the "=" and "!=" operations. *) Feature: the "proxy_pass" directive supports the HTTPS protocol. *) Feature: the "proxy_set_body" directive. *) Feature: the "post_action" directive. *) Feature: the ngx_http_empty_gif_module. *) Feature: the "worker_cpu_affinity" directive for Linux. *) Bugfix: the "rewrite" directive did not unescape URI part in redirect, now it is unescaped except the %00-%25 and %7F-%FF characters. *) Bugfix: nginx could not be built by the icc 9.0 compiler. *) Bugfix: if the SSI was enabled for zero size static file, then the chunked response was encoded incorrectly.
author Igor Sysoev <http://sysoev.ru>
date Tue, 15 Nov 2005 00:00:00 +0300
parents d25a1d6034f1
children 82d695e3d662
comparison
equal deleted inserted replaced
125:97504de1f89e 126:df17fbafec8f
339 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF 339 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
340 |NGX_CONF_2MORE, 340 |NGX_CONF_2MORE,
341 ngx_http_core_error_page, 341 ngx_http_core_error_page,
342 NGX_HTTP_LOC_CONF_OFFSET, 342 NGX_HTTP_LOC_CONF_OFFSET,
343 0, 343 0,
344 NULL },
345
346 { ngx_string("post_action"),
347 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
348 |NGX_CONF_TAKE1,
349 ngx_conf_set_str_slot,
350 NGX_HTTP_LOC_CONF_OFFSET,
351 offsetof(ngx_http_core_loc_conf_t, post_action),
344 NULL }, 352 NULL },
345 353
346 { ngx_string("error_log"), 354 { ngx_string("error_log"),
347 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, 355 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
348 ngx_http_core_error_log, 356 ngx_http_core_error_log,
512 rc = h[r->phase_handler](r); 520 rc = h[r->phase_handler](r);
513 521
514 if (rc == NGX_DONE) { 522 if (rc == NGX_DONE) {
515 523
516 /* 524 /*
517 * we should never use r here because 525 * we should never use r here because
518 * it may point to already freed data 526 * it may point to already freed data
519 */ 527 */
520 528
521 return; 529 return;
522 } 530 }
1032 1040
1033 if (encoded.len == 0) { 1041 if (encoded.len == 0) {
1034 r->headers_in.user.data = (u_char *) ""; 1042 r->headers_in.user.data = (u_char *) "";
1035 return NGX_DECLINED; 1043 return NGX_DECLINED;
1036 } 1044 }
1037 1045
1038 auth.len = ngx_base64_decoded_length(encoded.len); 1046 auth.len = ngx_base64_decoded_length(encoded.len);
1039 auth.data = ngx_palloc(r->pool, auth.len + 1); 1047 auth.data = ngx_palloc(r->pool, auth.len + 1);
1040 if (auth.data == NULL) { 1048 if (auth.data == NULL) {
1041 return NGX_ERROR; 1049 return NGX_ERROR;
1042 } 1050 }
1043 1051
1044 if (ngx_decode_base64(&auth, &encoded) != NGX_OK) { 1052 if (ngx_decode_base64(&auth, &encoded) != NGX_OK) {
1045 r->headers_in.user.data = (u_char *) ""; 1053 r->headers_in.user.data = (u_char *) "";
1046 return NGX_DECLINED; 1054 return NGX_DECLINED;
1047 } 1055 }
1048 1056
1049 auth.data[auth.len] = '\0'; 1057 auth.data[auth.len] = '\0';
1050 1058
1051 for (len = 0; len < auth.len; len++) { 1059 for (len = 0; len < auth.len; len++) {
1052 if (auth.data[len] == ':') { 1060 if (auth.data[len] == ':') {
1053 break; 1061 break;
1054 } 1062 }
1055 } 1063 }
1056 1064
1057 if (len == 0 || len == auth.len) { 1065 if (len == 0 || len == auth.len) {
1058 r->headers_in.user.data = (u_char *) ""; 1066 r->headers_in.user.data = (u_char *) "";
1059 return NGX_DECLINED; 1067 return NGX_DECLINED;
1060 } 1068 }
1061 1069
1103 sr->pool = r->pool; 1111 sr->pool = r->pool;
1104 1112
1105 sr->headers_in = r->headers_in; 1113 sr->headers_in = r->headers_in;
1106 1114
1107 sr->start_time = ngx_time(); 1115 sr->start_time = ngx_time();
1108 sr->headers_out.content_length_n = -1; 1116
1109 sr->headers_out.last_modified_time = -1; 1117 ngx_http_clear_content_length(sr);
1118 ngx_http_clear_accept_ranges(sr);
1119 ngx_http_clear_last_modified(sr);
1110 1120
1111 sr->request_body = r->request_body; 1121 sr->request_body = r->request_body;
1112 1122
1113 sr->method = NGX_HTTP_GET; 1123 sr->method = NGX_HTTP_GET;
1114 sr->http_version = r->http_version; 1124 sr->http_version = r->http_version;
1857 } 1867 }
1858 1868
1859 /* 1869 /*
1860 * set by ngx_pcalloc(): 1870 * set by ngx_pcalloc():
1861 * 1871 *
1862 * lcf->root.len = 0; 1872 * lcf->root = { 0, NULL };
1863 * lcf->root.data = NULL; 1873 * lcf->post_action = { 0, NULL };
1864 * lcf->types = NULL; 1874 * lcf->types = NULL;
1865 * lcf->default_type.len = 0; 1875 * lcf->default_type = { 0, NULL };
1866 * lcf->default_type.data = NULL;
1867 * lcf->err_log = NULL; 1876 * lcf->err_log = NULL;
1868 * lcf->error_pages = NULL; 1877 * lcf->error_pages = NULL;
1869 * lcf->client_body_path = NULL; 1878 * lcf->client_body_path = NULL;
1870 * lcf->regex = NULL; 1879 * lcf->regex = NULL;
1871 * lcf->exact_match = 0; 1880 * lcf->exact_match = 0;
1921 1930
1922 if (ngx_conf_full_name(cf->cycle, &conf->root) == NGX_ERROR) { 1931 if (ngx_conf_full_name(cf->cycle, &conf->root) == NGX_ERROR) {
1923 return NGX_CONF_ERROR; 1932 return NGX_CONF_ERROR;
1924 } 1933 }
1925 1934
1935 if (conf->post_action.data == NULL) {
1936 conf->post_action = prev->post_action;
1937 }
1938
1926 if (conf->types == NULL) { 1939 if (conf->types == NULL) {
1927 if (prev->types) { 1940 if (prev->types) {
1928 conf->types = prev->types; 1941 conf->types = prev->types;
1929 1942
1930 } else { 1943 } else {
1931 conf->types = ngx_palloc(cf->pool, NGX_HTTP_TYPES_HASH_PRIME 1944 conf->types = ngx_palloc(cf->pool, NGX_HTTP_TYPES_HASH_PRIME
1932 * sizeof(ngx_array_t)); 1945 * sizeof(ngx_array_t));
1933 if (conf->types == NULL) { 1946 if (conf->types == NULL) {
1934 return NGX_CONF_ERROR; 1947 return NGX_CONF_ERROR;
1935 } 1948 }
1936 1949
1937 for (i = 0; i < NGX_HTTP_TYPES_HASH_PRIME; i++) { 1950 for (i = 0; i < NGX_HTTP_TYPES_HASH_PRIME; i++) {
2036 * TODO: check duplicate 'listen' directives, 2049 * TODO: check duplicate 'listen' directives,
2037 * add resolved name to server names ??? 2050 * add resolved name to server names ???
2038 */ 2051 */
2039 2052
2040 value = cf->args->elts; 2053 value = cf->args->elts;
2041 2054
2042 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t)); 2055 ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t));
2043 2056
2044 inet_upstream.url = value[1]; 2057 inet_upstream.url = value[1];
2045 inet_upstream.port_only = 1; 2058 inet_upstream.port_only = 1;
2046 2059
2048 2061
2049 if (err) { 2062 if (err) {
2050 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 2063 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
2051 "%s in \"%V\" of the \"listen\" directive", 2064 "%s in \"%V\" of the \"listen\" directive",
2052 err, &inet_upstream.url); 2065 err, &inet_upstream.url);
2053 return NGX_CONF_ERROR; 2066 return NGX_CONF_ERROR;
2054 } 2067 }
2055 2068
2056 ls = ngx_array_push(&scf->listen); 2069 ls = ngx_array_push(&scf->listen);
2057 if (ls == NULL) { 2070 if (ls == NULL) {
2058 return NGX_CONF_ERROR; 2071 return NGX_CONF_ERROR;
2082 "can not resolve host \"%s\" " 2095 "can not resolve host \"%s\" "
2083 "in the \"listen\" directive", 2096 "in the \"listen\" directive",
2084 inet_upstream.host.data); 2097 inet_upstream.host.data);
2085 return NGX_CONF_ERROR; 2098 return NGX_CONF_ERROR;
2086 } 2099 }
2087 2100
2088 ls->addr = *(in_addr_t *)(h->h_addr_list[0]); 2101 ls->addr = *(in_addr_t *)(h->h_addr_list[0]);
2089 } 2102 }
2090 2103
2091 } else { 2104 } else {
2092 ls->addr = INADDR_ANY; 2105 ls->addr = INADDR_ANY;