comparison src/http/ngx_http_upstream.c @ 244:500a3242dff6 NGINX_0_4_7

nginx 0.4.7 *) Feature: the ngx_http_flv_module. *) Feature: the $request_body_file variable. *) Feature: the "charset" and "source_charset" directives support the variables. *) Bugfix: if an "include" SSI command were before another "include" SSI command with an "wait" parameter, then the "wait" parameter might not work. *) Bugfix: if the "proxy_buffering off" directive was used or while working with memcached the connections might not be closed on timeout. *) Bugfix: nginx did not run on 64-bit platforms except amd64, sparc64, and ppc64.
author Igor Sysoev <http://sysoev.ru>
date Tue, 10 Oct 2006 00:00:00 +0400
parents 38e7b94d63ac
children acd2ec3541cb
comparison
equal deleted inserted replaced
243:d371c9d33781 244:500a3242dff6
1135 } 1135 }
1136 1136
1137 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); 1137 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
1138 1138
1139 if (r->upstream->headers_in.x_accel_redirect) { 1139 if (r->upstream->headers_in.x_accel_redirect) {
1140
1140 ngx_http_upstream_finalize_request(r, u, NGX_DECLINED); 1141 ngx_http_upstream_finalize_request(r, u, NGX_DECLINED);
1141 1142
1142 part = &r->upstream->headers_in.headers.part; 1143 part = &r->upstream->headers_in.headers.part;
1143 h = part->elts; 1144 h = part->elts;
1144 1145
1157 hh = ngx_hash_find(&umcf->headers_in_hash, h[i].hash, 1158 hh = ngx_hash_find(&umcf->headers_in_hash, h[i].hash,
1158 h[i].lowcase_key, h[i].key.len); 1159 h[i].lowcase_key, h[i].key.len);
1159 1160
1160 if (hh && hh->redirect) { 1161 if (hh && hh->redirect) {
1161 if (hh->copy_handler(r, &h[i], hh->conf) != NGX_OK) { 1162 if (hh->copy_handler(r, &h[i], hh->conf) != NGX_OK) {
1162 ngx_http_upstream_finalize_request(r, u, 1163 ngx_http_finalize_request(r,
1163 NGX_HTTP_INTERNAL_SERVER_ERROR); 1164 NGX_HTTP_INTERNAL_SERVER_ERROR);
1164 return; 1165 return;
1165 } 1166 }
1166 } 1167 }
1167 } 1168 }
1168 1169
1170 args.len = 0; 1171 args.len = 0;
1171 args.data = NULL; 1172 args.data = NULL;
1172 flags = 0; 1173 flags = 0;
1173 1174
1174 if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) { 1175 if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) {
1175 ngx_http_upstream_finalize_request(r, u, NGX_HTTP_NOT_FOUND); 1176 ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND);
1176 return; 1177 return;
1177 } 1178 }
1178 1179
1179 if (flags & NGX_HTTP_ZERO_IN_URI) { 1180 if (flags & NGX_HTTP_ZERO_IN_URI) {
1180 r->zero_in_uri = 1; 1181 r->zero_in_uri = 1;
1498 ngx_http_request_t *r; 1499 ngx_http_request_t *r;
1499 ngx_http_upstream_t *u; 1500 ngx_http_upstream_t *u;
1500 ngx_http_core_loc_conf_t *clcf; 1501 ngx_http_core_loc_conf_t *clcf;
1501 1502
1502 c = ev->data; 1503 c = ev->data;
1504 r = c->data;
1505 u = r->upstream;
1503 1506
1504 if (ev->write) { 1507 if (ev->write) {
1505 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, 1508 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
1506 "http upstream process non buffered downstream"); 1509 "http upstream process non buffered downstream");
1507 c->log->action = "sending to client"; 1510 c->log->action = "sending to client";
1518 ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out"); 1521 ngx_connection_error(c, NGX_ETIMEDOUT, "client timed out");
1519 1522
1520 } else { 1523 } else {
1521 ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out"); 1524 ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out");
1522 } 1525 }
1523 } 1526
1524 1527 ngx_http_upstream_finalize_request(r, u, 0);
1525 r = c->data; 1528 return;
1526 u = r->upstream; 1529 }
1530
1527 client = r->connection; 1531 client = r->connection;
1528 1532
1529 b = &u->buffer; 1533 b = &u->buffer;
1530 1534
1531 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); 1535 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
2939 } 2943 }
2940 2944
2941 hash.hash = &umcf->headers_in_hash; 2945 hash.hash = &umcf->headers_in_hash;
2942 hash.key = ngx_hash_key_lc; 2946 hash.key = ngx_hash_key_lc;
2943 hash.max_size = 512; 2947 hash.max_size = 512;
2944 hash.bucket_size = ngx_cacheline_size; 2948 hash.bucket_size = ngx_align(64, ngx_cacheline_size);
2945 hash.name = "upstream_headers_in_hash"; 2949 hash.name = "upstream_headers_in_hash";
2946 hash.pool = cf->pool; 2950 hash.pool = cf->pool;
2947 hash.temp_pool = NULL; 2951 hash.temp_pool = NULL;
2948 2952
2949 if (ngx_hash_init(&hash, headers_in.elts, headers_in.nelts) != NGX_OK) { 2953 if (ngx_hash_init(&hash, headers_in.elts, headers_in.nelts) != NGX_OK) {