comparison src/event/ngx_event_openssl.c @ 356:b743d290eb3b NGINX_0_6_22

nginx 0.6.22 *) Change: now all ngx_http_perl_module methods return values copied to perl's allocated memory. *) Bugfix: if nginx was built with ngx_http_perl_module, the perl before 5.8.6 was used, and perl supported threads, then during reconfiguration the master process aborted; bug appeared in 0.5.9. Thanks to Boris Zhmurov. *) Bugfix: the ngx_http_perl_module methods may get invalid values of the regex captures. *) Bugfix: a segmentation fault occurred in worker process, if the $r->has_request_body() method was called for a request whose small request body was already received. *) Bugfix: large_client_header_buffers did not freed before going to keep-alive state. Thanks to Olexander Shtepa. *) Bugfix: the last address was missed in the $upstream_addr variable; bug appeared in 0.6.18. *) Bugfix: the "fastcgi_catch_stderr" directive did return error code; now it returns 502 code, that can be rerouted to a next server using the "fastcgi_next_upstream invalid_header" directive. *) Bugfix: a segmentation fault occurred in master process if the "fastcgi_catch_stderr" directive was used; bug appeared in 0.6.10. Thanks to Manlio Perillo.
author Igor Sysoev <http://sysoev.ru>
date Wed, 19 Dec 2007 00:00:00 +0300
parents 3a91bfeffaba
children 9121a0a91f47
comparison
equal deleted inserted replaced
355:3ac45897a61c 356:b743d290eb3b
1239 sentinel = ngx_slab_alloc(shpool, sizeof(ngx_rbtree_node_t)); 1239 sentinel = ngx_slab_alloc(shpool, sizeof(ngx_rbtree_node_t));
1240 if (sentinel == NULL) { 1240 if (sentinel == NULL) {
1241 return NGX_ERROR; 1241 return NGX_ERROR;
1242 } 1242 }
1243 1243
1244 ngx_rbtree_sentinel_init(sentinel); 1244 ngx_rbtree_init(cache->session_rbtree, sentinel,
1245 1245 ngx_ssl_session_rbtree_insert_value);
1246 cache->session_rbtree->root = sentinel;
1247 cache->session_rbtree->sentinel = sentinel;
1248 cache->session_rbtree->insert = ngx_ssl_session_rbtree_insert_value;
1249 1246
1250 shm_zone->data = cache; 1247 shm_zone->data = cache;
1251 1248
1252 return NGX_OK; 1249 return NGX_OK;
1253 } 1250 }
1623 1620
1624 static void 1621 static void
1625 ngx_ssl_session_rbtree_insert_value(ngx_rbtree_node_t *temp, 1622 ngx_ssl_session_rbtree_insert_value(ngx_rbtree_node_t *temp,
1626 ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel) 1623 ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
1627 { 1624 {
1628 ngx_ssl_sess_id_t *sess_id, *sess_id_temp; 1625 ngx_rbtree_node_t **p;
1626 ngx_ssl_sess_id_t *sess_id, *sess_id_temp;
1629 1627
1630 for ( ;; ) { 1628 for ( ;; ) {
1631 1629
1632 if (node->key < temp->key) { 1630 if (node->key < temp->key) {
1633 1631
1634 if (temp->left == sentinel) { 1632 p = &temp->left;
1635 temp->left = node;
1636 break;
1637 }
1638
1639 temp = temp->left;
1640 1633
1641 } else if (node->key > temp->key) { 1634 } else if (node->key > temp->key) {
1642 1635
1643 if (temp->right == sentinel) { 1636 p = &temp->right;
1644 temp->right = node;
1645 break;
1646 }
1647
1648 temp = temp->right;
1649 1637
1650 } else { /* node->key == temp->key */ 1638 } else { /* node->key == temp->key */
1651 1639
1652 sess_id = (ngx_ssl_sess_id_t *) node; 1640 sess_id = (ngx_ssl_sess_id_t *) node;
1653 sess_id_temp = (ngx_ssl_sess_id_t *) temp; 1641 sess_id_temp = (ngx_ssl_sess_id_t *) temp;
1654 1642
1655 if (ngx_memn2cmp(sess_id->id, sess_id_temp->id, 1643 p = (ngx_memn2cmp(sess_id->id, sess_id_temp->id,
1656 (size_t) node->data, (size_t) temp->data) 1644 (size_t) node->data, (size_t) temp->data)
1657 < 0) 1645 < 0) ? &temp->left : &temp->right;
1658 { 1646 }
1659 if (temp->left == sentinel) { 1647
1660 temp->left = node; 1648 if (*p == sentinel) {
1661 break; 1649 break;
1662 } 1650 }
1663 1651
1664 temp = temp->left; 1652 temp = *p;
1665 1653 }
1666 } else { 1654
1667 1655 *p = node;
1668 if (temp->right == sentinel) {
1669 temp->right = node;
1670 break;
1671 }
1672
1673 temp = temp->right;
1674 }
1675 }
1676 }
1677
1678 node->parent = temp; 1656 node->parent = temp;
1679 node->left = sentinel; 1657 node->left = sentinel;
1680 node->right = sentinel; 1658 node->right = sentinel;
1681 ngx_rbt_red(node); 1659 ngx_rbt_red(node);
1682 } 1660 }