comparison src/http/ngx_http_request.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
49 size_t len); 49 size_t len);
50 50
51 #if (NGX_HTTP_SSL) 51 #if (NGX_HTTP_SSL)
52 static void ngx_http_ssl_handshake(ngx_event_t *rev); 52 static void ngx_http_ssl_handshake(ngx_event_t *rev);
53 static void ngx_http_ssl_handshake_handler(ngx_connection_t *c); 53 static void ngx_http_ssl_handshake_handler(ngx_connection_t *c);
54 static void ngx_http_ssl_close_handler(ngx_event_t *ev);
55 #endif 54 #endif
56 55
57 56
58 static char *ngx_http_client_errors[] = { 57 static char *ngx_http_client_errors[] = {
59 58
449 c->timedout = 1; 448 c->timedout = 1;
450 ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT); 449 ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT);
451 return; 450 return;
452 } 451 }
453 452
454 n = recv(c->fd, buf, 1, MSG_PEEK); 453 n = recv(c->fd, buf, 1, MSG_PEEK);
455 454
456 if (n == -1 && ngx_socket_errno == NGX_EAGAIN) { 455 if (n == -1 && ngx_socket_errno == NGX_EAGAIN) {
457 return; 456 return;
458 } 457 }
459 458
1344 r->server_name = name[i].name; 1343 r->server_name = name[i].name;
1345 goto found; 1344 goto found;
1346 } 1345 }
1347 1346
1348 if (rc < 0) { 1347 if (rc < 0) {
1349 /* the server names are lexicographically sorted */ 1348 /* the server names are lexicographically sorted */
1350 break; 1349 break;
1351 } 1350 }
1352 } 1351 }
1353 1352
1354 if (r->virtual_names->wildcards.nelts) { 1353 if (r->virtual_names->wildcards.nelts) {
1515 return; 1514 return;
1516 } 1515 }
1517 1516
1518 if (r->out) { 1517 if (r->out) {
1519 (void) ngx_http_set_write_handler(r); 1518 (void) ngx_http_set_write_handler(r);
1519 return;
1520 }
1521
1522 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1523
1524 if (clcf->post_action.data) {
1525 ngx_http_internal_redirect(r, &clcf->post_action, NULL);
1520 return; 1526 return;
1521 } 1527 }
1522 1528
1523 if (r->connection->read->timer_set) { 1529 if (r->connection->read->timer_set) {
1524 ngx_del_timer(r->connection->read); 1530 ngx_del_timer(r->connection->read);
1536 "kevent() reported about an closed connection"); 1542 "kevent() reported about an closed connection");
1537 #endif 1543 #endif
1538 ngx_http_close_request(r, 0); 1544 ngx_http_close_request(r, 0);
1539 return; 1545 return;
1540 } 1546 }
1541
1542 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1543 1547
1544 if (!ngx_terminate 1548 if (!ngx_terminate
1545 && !ngx_exiting 1549 && !ngx_exiting
1546 && r->keepalive != 0 1550 && r->keepalive != 0
1547 && clcf->keepalive_timeout > 0) 1551 && clcf->keepalive_timeout > 0)
1892 1896
1893 /* 1897 /*
1894 * If the large header buffers were allocated while the previous 1898 * If the large header buffers were allocated while the previous
1895 * request processing then we do not use c->buffer for 1899 * request processing then we do not use c->buffer for
1896 * the pipelined request (see ngx_http_init_request()). 1900 * the pipelined request (see ngx_http_init_request()).
1897 * 1901 *
1898 * Now we would move the large header buffers to the free list. 1902 * Now we would move the large header buffers to the free list.
1899 */ 1903 */
1900 1904
1901 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); 1905 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
1902 1906
2176 } 2180 }
2177 2181
2178 2182
2179 static void 2183 static void
2180 ngx_http_set_lingering_close(ngx_http_request_t *r) 2184 ngx_http_set_lingering_close(ngx_http_request_t *r)
2181 { 2185 {
2182 ngx_event_t *rev, *wev; 2186 ngx_event_t *rev, *wev;
2183 ngx_connection_t *c; 2187 ngx_connection_t *c;
2184 ngx_http_core_loc_conf_t *clcf; 2188 ngx_http_core_loc_conf_t *clcf;
2185 2189
2186 c = r->connection; 2190 c = r->connection;
2246 2250
2247 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, 2251 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
2248 "http lingering close handler"); 2252 "http lingering close handler");
2249 2253
2250 if (rev->timedout) { 2254 if (rev->timedout) {
2255 c->timedout = 1;
2251 ngx_http_close_request(r, 0); 2256 ngx_http_close_request(r, 0);
2252 return; 2257 return;
2253 } 2258 }
2254 2259
2255 timer = r->lingering_time - ngx_time(); 2260 timer = r->lingering_time - ngx_time();
2421 2426
2422 #if (NGX_HTTP_SSL) 2427 #if (NGX_HTTP_SSL)
2423 2428
2424 if (c->ssl) { 2429 if (c->ssl) {
2425 if (ngx_ssl_shutdown(c) == NGX_AGAIN) { 2430 if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
2426 c->read->handler = ngx_http_ssl_close_handler; 2431 c->ssl->handler = ngx_http_close_connection;
2427 c->write->handler = ngx_http_ssl_close_handler;
2428 return; 2432 return;
2429 } 2433 }
2430 } 2434 }
2431 2435
2432 #endif 2436 #endif
2439 2443
2440 ngx_close_connection(c); 2444 ngx_close_connection(c);
2441 2445
2442 ngx_destroy_pool(pool); 2446 ngx_destroy_pool(pool);
2443 } 2447 }
2444
2445
2446 #if (NGX_HTTP_SSL)
2447
2448 static void
2449 ngx_http_ssl_close_handler(ngx_event_t *ev)
2450 {
2451 ngx_connection_t *c;
2452
2453 c = ev->data;
2454
2455 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ev->log, 0, "http ssl close handler");
2456
2457 if (ngx_ssl_shutdown(c) == NGX_AGAIN) {
2458 return;
2459 }
2460
2461 ngx_http_close_connection(c);
2462 }
2463
2464 #endif
2465 2448
2466 2449
2467 static u_char * 2450 static u_char *
2468 ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len) 2451 ngx_http_log_error(ngx_log_t *log, u_char *buf, size_t len)
2469 { 2452 {