Mercurial > hg > nginx-vendor-0-5
comparison src/http/ngx_http_request.c @ 56:3050baa54a26 NGINX_0_1_28
nginx 0.1.28
*) Bugfix: nginx hogs CPU while proxying the huge files.
*) Bugfix: nginx could not be built by gcc 4.0 on Linux.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 08 Apr 2005 00:00:00 +0400 |
parents | bcb5fce0b038 |
children | b55cbf18157e |
comparison
equal
deleted
inserted
replaced
55:729de7d75018 | 56:3050baa54a26 |
---|---|
342 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); | 342 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); |
343 if (sscf->enable) { | 343 if (sscf->enable) { |
344 | 344 |
345 if (c->ssl == NULL) { | 345 if (c->ssl == NULL) { |
346 if (ngx_ssl_create_session(sscf->ssl_ctx, c, NGX_SSL_BUFFER) | 346 if (ngx_ssl_create_session(sscf->ssl_ctx, c, NGX_SSL_BUFFER) |
347 == NGX_ERROR) | 347 == NGX_ERROR) |
348 { | 348 { |
349 ngx_http_close_connection(c); | 349 ngx_http_close_connection(c); |
350 return; | 350 return; |
351 } | 351 } |
352 | 352 |
705 | 705 |
706 | 706 |
707 static void | 707 static void |
708 ngx_http_process_request_headers(ngx_event_t *rev) | 708 ngx_http_process_request_headers(ngx_event_t *rev) |
709 { | 709 { |
710 ssize_t n; | 710 ssize_t n; |
711 ngx_int_t rc, rv, i; | 711 ngx_int_t rc, rv; |
712 ngx_str_t header; | 712 ngx_uint_t key; |
713 ngx_table_elt_t *h, **cookie; | 713 ngx_str_t header; |
714 ngx_connection_t *c; | 714 ngx_table_elt_t *h, **cookie; |
715 ngx_http_request_t *r; | 715 ngx_connection_t *c; |
716 ngx_http_header_t *hh; | |
717 ngx_http_request_t *r; | |
718 ngx_http_core_main_conf_t *cmcf; | |
716 | 719 |
717 c = rev->data; | 720 c = rev->data; |
718 r = c->data; | 721 r = c->data; |
719 | 722 |
720 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, | 723 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, |
725 c->timedout = 1; | 728 c->timedout = 1; |
726 ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT); | 729 ngx_http_close_request(r, NGX_HTTP_REQUEST_TIME_OUT); |
727 ngx_http_close_connection(c); | 730 ngx_http_close_connection(c); |
728 return; | 731 return; |
729 } | 732 } |
733 | |
734 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); | |
735 hh = (ngx_http_header_t *) cmcf->headers_in_hash.buckets; | |
730 | 736 |
731 rc = NGX_AGAIN; | 737 rc = NGX_AGAIN; |
732 | 738 |
733 for ( ;; ) { | 739 for ( ;; ) { |
734 | 740 |
789 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | 795 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
790 ngx_http_close_connection(c); | 796 ngx_http_close_connection(c); |
791 return; | 797 return; |
792 } | 798 } |
793 | 799 |
800 h->hash = r->header_hash; | |
801 | |
794 h->key.len = r->header_name_end - r->header_name_start; | 802 h->key.len = r->header_name_end - r->header_name_start; |
795 h->key.data = r->header_name_start; | 803 h->key.data = r->header_name_start; |
796 h->key.data[h->key.len] = '\0'; | 804 h->key.data[h->key.len] = '\0'; |
797 | 805 |
798 h->value.len = r->header_end - r->header_start; | 806 h->value.len = r->header_end - r->header_start; |
810 } | 818 } |
811 | 819 |
812 *cookie = h; | 820 *cookie = h; |
813 | 821 |
814 } else { | 822 } else { |
815 | 823 key = h->hash % cmcf->headers_in_hash.hash_size; |
816 for (i = 0; ngx_http_headers_in[i].name.len != 0; i++) { | 824 |
817 if (ngx_http_headers_in[i].name.len != h->key.len) { | 825 if (hh[key].name.len == h->key.len |
818 continue; | 826 && ngx_strcasecmp(hh[key].name.data, h->key.data) == 0) |
819 } | 827 { |
820 | 828 *((ngx_table_elt_t **) |
821 if (ngx_strcasecmp(ngx_http_headers_in[i].name.data, | 829 ((char *) &r->headers_in + hh[key].offset)) = h; |
822 h->key.data) == 0) | |
823 { | |
824 *((ngx_table_elt_t **) ((char *) &r->headers_in | |
825 + ngx_http_headers_in[i].offset)) = h; | |
826 break; | |
827 } | |
828 } | 830 } |
829 } | 831 } |
830 | 832 |
831 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 833 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
832 "http header: \"%V: %V\"", | 834 "http header: \"%V: %V\"", |
1235 ngx_http_find_virtual_server(ngx_http_request_t *r) | 1237 ngx_http_find_virtual_server(ngx_http_request_t *r) |
1236 { | 1238 { |
1237 ngx_int_t rc; | 1239 ngx_int_t rc; |
1238 ngx_uint_t i, n, key, found; | 1240 ngx_uint_t i, n, key, found; |
1239 ngx_http_server_name_t *name; | 1241 ngx_http_server_name_t *name; |
1242 ngx_http_core_loc_conf_t *clcf; | |
1243 ngx_http_core_srv_conf_t *cscf; | |
1240 ngx_http_core_main_conf_t *cmcf; | 1244 ngx_http_core_main_conf_t *cmcf; |
1241 ngx_http_core_srv_conf_t *cscf; | |
1242 ngx_http_core_loc_conf_t *clcf; | |
1243 | 1245 |
1244 if (r->virtual_names->hash) { | 1246 if (r->virtual_names->hash) { |
1245 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); | 1247 cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); |
1246 | 1248 |
1247 ngx_http_server_names_hash_key(key, | 1249 ngx_http_server_names_hash_key(key, |