comparison src/http/ngx_http_request.c @ 392:34fb3a573548 NGINX_0_7_8

nginx 0.7.8 *) Feature: the ngx_http_xslt_module. *) Feature: the "$arg_..." variables. *) Feature: Solaris directio support. Thanks to Ivan Debnar. *) Bugfix: now if FastCGI server sends a "Location" header line without status line, then nginx uses 302 status code. Thanks to Maxim Dounin.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Aug 2008 00:00:00 +0400
parents 0b6053502c55
children 6ebbca3d5ed7
comparison
equal deleted inserted replaced
391:4ec606a899d3 392:34fb3a573548
645 645
646 /* the request line has been parsed successfully */ 646 /* the request line has been parsed successfully */
647 647
648 r->request_line.len = r->request_end - r->request_start; 648 r->request_line.len = r->request_end - r->request_start;
649 r->request_line.data = r->request_start; 649 r->request_line.data = r->request_start;
650 *r->request_end = '\0';
650 651
651 652
652 if (r->args_start) { 653 if (r->args_start) {
653 r->uri.len = r->args_start - 1 - r->uri_start; 654 r->uri.len = r->args_start - 1 - r->uri_start;
654 } else { 655 } else {
816 ngx_http_process_request_headers(ngx_event_t *rev) 817 ngx_http_process_request_headers(ngx_event_t *rev)
817 { 818 {
818 ssize_t n; 819 ssize_t n;
819 ngx_int_t rc, rv; 820 ngx_int_t rc, rv;
820 ngx_str_t header; 821 ngx_str_t header;
821 ngx_uint_t i;
822 ngx_table_elt_t *h; 822 ngx_table_elt_t *h;
823 ngx_connection_t *c; 823 ngx_connection_t *c;
824 ngx_http_header_t *hh; 824 ngx_http_header_t *hh;
825 ngx_http_request_t *r; 825 ngx_http_request_t *r;
826 ngx_http_core_srv_conf_t *cscf; 826 ngx_http_core_srv_conf_t *cscf;
926 926
927 if (h->key.len == r->lowcase_index) { 927 if (h->key.len == r->lowcase_index) {
928 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); 928 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
929 929
930 } else { 930 } else {
931 for (i = 0; i < h->key.len; i++) { 931 ngx_strlow(h->lowcase_key, h->key.data, h->key.len);
932 h->lowcase_key[i] = ngx_tolower(h->key.data[i]);
933 }
934 } 932 }
935 933
936 hh = ngx_hash_find(&cmcf->headers_in_hash, h->hash, 934 hh = ngx_hash_find(&cmcf->headers_in_hash, h->hash,
937 h->lowcase_key, h->key.len); 935 h->lowcase_key, h->key.len);
938 936
1550 1548
1551 1549
1552 static ngx_int_t 1550 static ngx_int_t
1553 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len) 1551 ngx_http_find_virtual_server(ngx_http_request_t *r, u_char *host, size_t len)
1554 { 1552 {
1555 u_char *server, ch; 1553 u_char *server;
1556 ngx_uint_t i, hash; 1554 ngx_uint_t hash;
1557 ngx_http_core_loc_conf_t *clcf; 1555 ngx_http_core_loc_conf_t *clcf;
1558 ngx_http_core_srv_conf_t *cscf; 1556 ngx_http_core_srv_conf_t *cscf;
1559 u_char buf[32]; 1557 u_char buf[32];
1560 1558
1561 if (len == 0 || r->virtual_names == NULL) { 1559 if (len == 0 || r->virtual_names == NULL) {
1570 if (server == NULL) { 1568 if (server == NULL) {
1571 return NGX_ERROR; 1569 return NGX_ERROR;
1572 } 1570 }
1573 } 1571 }
1574 1572
1575 hash = 0; 1573 hash = ngx_hash_strlow(server, host, len);
1576
1577 for (i = 0; i < len; i++) {
1578 ch = host[i];
1579
1580 ch = ngx_tolower(ch);
1581 server[i] = ch;
1582
1583 hash = ngx_hash(hash, ch);
1584 }
1585 1574
1586 cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len); 1575 cscf = ngx_hash_find_combined(&r->virtual_names->names, hash, server, len);
1587 1576
1588 if (cscf) { 1577 if (cscf) {
1589 goto found; 1578 goto found;