comparison src/http/modules/ngx_http_scgi_module.c @ 656:9d21dad0b5a1 NGINX_1_1_12

nginx 1.1.12 *) Change: a "proxy_pass" directive without URI part now uses changed URI after redirection with the "error_page" directive; Thanks to Lanshun Zhou. *) Feature: the "proxy/fastcgi/scgi/uwsgi_cache_lock", "proxy/fastcgi/scgi/uwsgi_cache_lock_timeout" directives. *) Feature: the "pcre_jit" directive. *) Feature: the "if" SSI command supports captures in regular expressions. *) Bugfix: the "if" SSI command did not work inside the "block" command. *) Bugfix: the "limit_conn_log_level" and "limit_req_log_level" directives might not work. *) Bugfix: the "limit_rate" directive did not allow to use full throughput, even if limit value was very high. *) Bugfix: the "sendfile_max_chunk" directive did not work, if the "limit_rate" directive was used. *) Bugfix: a "proxy_pass" directive without URI part always used original request URI if variables were used. *) Bugfix: a "proxy_pass" directive without URI part might use original request after redirection with the "try_files" directive; Thanks to Lanshun Zhou. *) Bugfix: in the ngx_http_scgi_module. *) Bugfix: in the ngx_http_mp4_module. *) Bugfix: nginx could not be built on Solaris; the bug had appeared in 1.1.9.
author Igor Sysoev <http://sysoev.ru>
date Mon, 26 Dec 2011 00:00:00 +0400
parents 753f505670e0
children 5a4401b9551b
comparison
equal deleted inserted replaced
655:189afff6503f 656:9d21dad0b5a1
33 static ngx_int_t ngx_http_scgi_eval(ngx_http_request_t *r, 33 static ngx_int_t ngx_http_scgi_eval(ngx_http_request_t *r,
34 ngx_http_scgi_loc_conf_t *scf); 34 ngx_http_scgi_loc_conf_t *scf);
35 static ngx_int_t ngx_http_scgi_create_request(ngx_http_request_t *r); 35 static ngx_int_t ngx_http_scgi_create_request(ngx_http_request_t *r);
36 static ngx_int_t ngx_http_scgi_reinit_request(ngx_http_request_t *r); 36 static ngx_int_t ngx_http_scgi_reinit_request(ngx_http_request_t *r);
37 static ngx_int_t ngx_http_scgi_process_status_line(ngx_http_request_t *r); 37 static ngx_int_t ngx_http_scgi_process_status_line(ngx_http_request_t *r);
38 static ngx_int_t ngx_http_scgi_process_header(ngx_http_request_t *r);
39 static ngx_int_t ngx_http_scgi_process_header(ngx_http_request_t *r); 38 static ngx_int_t ngx_http_scgi_process_header(ngx_http_request_t *r);
40 static void ngx_http_scgi_abort_request(ngx_http_request_t *r); 39 static void ngx_http_scgi_abort_request(ngx_http_request_t *r);
41 static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc); 40 static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc);
42 41
43 static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf); 42 static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf);
244 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, 243 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
245 ngx_conf_set_bitmask_slot, 244 ngx_conf_set_bitmask_slot,
246 NGX_HTTP_LOC_CONF_OFFSET, 245 NGX_HTTP_LOC_CONF_OFFSET,
247 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_methods), 246 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_methods),
248 &ngx_http_upstream_cache_method_mask }, 247 &ngx_http_upstream_cache_method_mask },
248
249 { ngx_string("scgi_cache_lock"),
250 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
251 ngx_conf_set_flag_slot,
252 NGX_HTTP_LOC_CONF_OFFSET,
253 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_lock),
254 NULL },
255
256 { ngx_string("scgi_cache_lock_timeout"),
257 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
258 ngx_conf_set_msec_slot,
259 NGX_HTTP_LOC_CONF_OFFSET,
260 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_lock_timeout),
261 NULL },
249 262
250 #endif 263 #endif
251 264
252 { ngx_string("scgi_temp_path"), 265 { ngx_string("scgi_temp_path"),
253 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, 266 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234,
855 if (rc == NGX_AGAIN) { 868 if (rc == NGX_AGAIN) {
856 return rc; 869 return rc;
857 } 870 }
858 871
859 if (rc == NGX_ERROR) { 872 if (rc == NGX_ERROR) {
860
861 r->http_version = NGX_HTTP_VERSION_9;
862
863 u->process_header = ngx_http_scgi_process_header; 873 u->process_header = ngx_http_scgi_process_header;
864
865 return ngx_http_scgi_process_header(r); 874 return ngx_http_scgi_process_header(r);
866 } 875 }
867 876
868 if (u->state) { 877 if (u->state) {
869 u->state->status = status->code; 878 u->state->status = status->code;
959 /* a whole header has been parsed successfully */ 968 /* a whole header has been parsed successfully */
960 969
961 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 970 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
962 "http scgi header done"); 971 "http scgi header done");
963 972
964 if (r->http_version > NGX_HTTP_VERSION_9) { 973 u = r->upstream;
974
975 if (u->headers_in.status_n) {
965 return NGX_OK; 976 return NGX_OK;
966 } 977 }
967
968 u = r->upstream;
969 978
970 if (u->headers_in.status) { 979 if (u->headers_in.status) {
971 status_line = &u->headers_in.status->value; 980 status_line = &u->headers_in.status->value;
972 981
973 status = ngx_atoi(status_line->data, 3); 982 status = ngx_atoi(status_line->data, 3);
976 "upstream sent invalid status \"%V\"", 985 "upstream sent invalid status \"%V\"",
977 status_line); 986 status_line);
978 return NGX_HTTP_UPSTREAM_INVALID_HEADER; 987 return NGX_HTTP_UPSTREAM_INVALID_HEADER;
979 } 988 }
980 989
981 r->http_version = NGX_HTTP_VERSION_10;
982 u->headers_in.status_n = status; 990 u->headers_in.status_n = status;
983 u->headers_in.status_line = *status_line; 991 u->headers_in.status_line = *status_line;
984 992
985 } else if (u->headers_in.location) { 993 } else if (u->headers_in.location) {
986 r->http_version = NGX_HTTP_VERSION_10;
987 u->headers_in.status_n = 302; 994 u->headers_in.status_n = 302;
988 ngx_str_set(&u->headers_in.status_line, 995 ngx_str_set(&u->headers_in.status_line,
989 "302 Moved Temporarily"); 996 "302 Moved Temporarily");
990 997
991 } else { 998 } else {
992 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
993 "upstream sent neither valid HTTP/1.0 header "
994 "nor \"Status\" header line");
995 u->headers_in.status_n = 200; 999 u->headers_in.status_n = 200;
996 ngx_str_set(&u->headers_in.status_line, "200 OK"); 1000 ngx_str_set(&u->headers_in.status_line, "200 OK");
997 } 1001 }
998 1002
999 if (u->state) { 1003 if (u->state) {
1070 conf->upstream.cache = NGX_CONF_UNSET_PTR; 1074 conf->upstream.cache = NGX_CONF_UNSET_PTR;
1071 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT; 1075 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
1072 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR; 1076 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR;
1073 conf->upstream.no_cache = NGX_CONF_UNSET_PTR; 1077 conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
1074 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; 1078 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
1079 conf->upstream.cache_lock = NGX_CONF_UNSET;
1080 conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
1075 #endif 1081 #endif
1076 1082
1077 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR; 1083 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
1078 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR; 1084 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
1079 1085
1296 prev->upstream.cache_valid, NULL); 1302 prev->upstream.cache_valid, NULL);
1297 1303
1298 if (conf->cache_key.value.data == NULL) { 1304 if (conf->cache_key.value.data == NULL) {
1299 conf->cache_key = prev->cache_key; 1305 conf->cache_key = prev->cache_key;
1300 } 1306 }
1307
1308 ngx_conf_merge_value(conf->upstream.cache_lock,
1309 prev->upstream.cache_lock, 0);
1310
1311 ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout,
1312 prev->upstream.cache_lock_timeout, 5000);
1301 1313
1302 #endif 1314 #endif
1303 1315
1304 ngx_conf_merge_value(conf->upstream.pass_request_headers, 1316 ngx_conf_merge_value(conf->upstream.pass_request_headers,
1305 prev->upstream.pass_request_headers, 1); 1317 prev->upstream.pass_request_headers, 1);