comparison src/core/ngx_hash.c @ 678:981b4c44593b NGINX_1_3_2

nginx 1.3.2 *) Change: the "single" parameter of the "keepalive" directive is now ignored. *) Change: SSL compression is now disabled when using all versions of OpenSSL, including ones prior to 1.0.0. *) Feature: it is now possible to use the "ip_hash" directive to balance IPv6 clients. *) Feature: the $status variable can now be used not only in the "log_format" directive. *) Bugfix: a segmentation fault might occur in a worker process on shutdown if the "resolver" directive was used. *) Bugfix: a segmentation fault might occur in a worker process if the ngx_http_mp4_module was used. *) Bugfix: in the ngx_http_mp4_module. *) Bugfix: a segmentation fault might occur in a worker process if conflicting wildcard server names were used. *) Bugfix: nginx might be terminated abnormally on a SIGBUS signal on ARM platform. *) Bugfix: an alert "sendmsg() failed (9: Bad file number)" on HP-UX while reconfiguration.
author Igor Sysoev <http://sysoev.ru>
date Tue, 26 Jun 2012 00:00:00 +0400
parents d0f7a625f27c
children
comparison
equal deleted inserted replaced
677:47f0934d8824 678:981b4c44593b
922 hwc = &ha->dns_wc_tail; 922 hwc = &ha->dns_wc_tail;
923 keys = &ha->dns_wc_tail_hash[k]; 923 keys = &ha->dns_wc_tail_hash[k];
924 } 924 }
925 925
926 926
927 /* check conflicts in wildcard hash */
928
929 name = keys->elts;
930
931 if (name) {
932 len = last - skip;
933
934 for (i = 0; i < keys->nelts; i++) {
935 if (len != name[i].len) {
936 continue;
937 }
938
939 if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) {
940 return NGX_BUSY;
941 }
942 }
943
944 } else {
945 if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK)
946 {
947 return NGX_ERROR;
948 }
949 }
950
951 name = ngx_array_push(keys);
952 if (name == NULL) {
953 return NGX_ERROR;
954 }
955
956 name->len = last - skip;
957 name->data = ngx_pnalloc(ha->temp_pool, name->len);
958 if (name->data == NULL) {
959 return NGX_ERROR;
960 }
961
962 ngx_memcpy(name->data, key->data + skip, name->len);
963
964
965 /* add to wildcard hash */
966
927 hk = ngx_array_push(hwc); 967 hk = ngx_array_push(hwc);
928 if (hk == NULL) { 968 if (hk == NULL) {
929 return NGX_ERROR; 969 return NGX_ERROR;
930 } 970 }
931 971
932 hk->key.len = last - 1; 972 hk->key.len = last - 1;
933 hk->key.data = p; 973 hk->key.data = p;
934 hk->key_hash = 0; 974 hk->key_hash = 0;
935 hk->value = value; 975 hk->value = value;
936 976
937
938 /* check conflicts in wildcard hash */
939
940 name = keys->elts;
941
942 if (name) {
943 len = last - skip;
944
945 for (i = 0; i < keys->nelts; i++) {
946 if (len != name[i].len) {
947 continue;
948 }
949
950 if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) {
951 return NGX_BUSY;
952 }
953 }
954
955 } else {
956 if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK)
957 {
958 return NGX_ERROR;
959 }
960 }
961
962 name = ngx_array_push(keys);
963 if (name == NULL) {
964 return NGX_ERROR;
965 }
966
967 name->len = last - skip;
968 name->data = ngx_pnalloc(ha->temp_pool, name->len);
969 if (name->data == NULL) {
970 return NGX_ERROR;
971 }
972
973 ngx_memcpy(name->data, key->data + skip, name->len);
974
975 return NGX_OK; 977 return NGX_OK;
976 } 978 }