Mercurial > hg > nginx-ranges
comparison src/http/ngx_http_request.c @ 635:e67b227c8dbb default tip
Merge with current.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 25 Apr 2011 04:07:55 +0400 |
parents | b9763778e212 |
children |
comparison
equal
deleted
inserted
replaced
578:f3a9e57d2e17 | 635:e67b227c8dbb |
---|---|
84 { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection), | 84 { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection), |
85 ngx_http_process_connection }, | 85 ngx_http_process_connection }, |
86 | 86 |
87 { ngx_string("If-Modified-Since"), | 87 { ngx_string("If-Modified-Since"), |
88 offsetof(ngx_http_headers_in_t, if_modified_since), | 88 offsetof(ngx_http_headers_in_t, if_modified_since), |
89 ngx_http_process_unique_header_line }, | |
90 | |
91 { ngx_string("If-Unmodified-Since"), | |
92 offsetof(ngx_http_headers_in_t, if_unmodified_since), | |
89 ngx_http_process_unique_header_line }, | 93 ngx_http_process_unique_header_line }, |
90 | 94 |
91 { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent), | 95 { ngx_string("User-Agent"), offsetof(ngx_http_headers_in_t, user_agent), |
92 ngx_http_process_user_agent }, | 96 ngx_http_process_user_agent }, |
93 | 97 |
553 | 557 |
554 return; | 558 return; |
555 } | 559 } |
556 | 560 |
557 if (n == 1) { | 561 if (n == 1) { |
558 if (buf[0] == 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) { | 562 if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) { |
559 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, | 563 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, |
560 "https ssl handshake: 0x%02Xd", buf[0]); | 564 "https ssl handshake: 0x%02Xd", buf[0]); |
561 | 565 |
562 rc = ngx_ssl_handshake(c); | 566 rc = ngx_ssl_handshake(c); |
563 | 567 |
754 | 758 |
755 | 759 |
756 r->unparsed_uri.len = r->uri_end - r->uri_start; | 760 r->unparsed_uri.len = r->uri_end - r->uri_start; |
757 r->unparsed_uri.data = r->uri_start; | 761 r->unparsed_uri.data = r->uri_start; |
758 | 762 |
763 r->valid_unparsed_uri = r->space_in_uri ? 0 : 1; | |
759 | 764 |
760 r->method_name.len = r->method_end - r->request_start + 1; | 765 r->method_name.len = r->method_end - r->request_start + 1; |
761 r->method_name.data = r->request_line.data; | 766 r->method_name.data = r->request_line.data; |
762 | 767 |
763 | 768 |
786 { | 791 { |
787 u_char *p; | 792 u_char *p; |
788 | 793 |
789 p = r->uri.data + r->uri.len - 1; | 794 p = r->uri.data + r->uri.len - 1; |
790 | 795 |
791 if (*p == '.' || *p == ' ') { | 796 while (p > r->uri.data) { |
792 | 797 |
793 while (--p > r->uri.data && (*p == '.' || *p == ' ')) { | 798 if (*p == ' ') { |
794 /* void */ | 799 p--; |
800 continue; | |
795 } | 801 } |
796 | 802 |
803 if (*p == '.') { | |
804 p--; | |
805 continue; | |
806 } | |
807 | |
808 if (ngx_strncasecmp(p - 6, (u_char *) "::$data", 7) == 0) { | |
809 p -= 7; | |
810 continue; | |
811 } | |
812 | |
813 break; | |
814 } | |
815 | |
816 if (p != r->uri.data + r->uri.len - 1) { | |
797 r->uri.len = p + 1 - r->uri.data; | 817 r->uri.len = p + 1 - r->uri.data; |
798 | |
799 ngx_http_set_exten(r); | 818 ngx_http_set_exten(r); |
800 } | 819 } |
820 | |
801 } | 821 } |
802 #endif | 822 #endif |
803 | 823 |
804 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | 824 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
805 "http request line: \"%V\"", &r->request_line); | 825 "http request line: \"%V\"", &r->request_line); |
956 } | 976 } |
957 | 977 |
958 if (rv == NGX_DECLINED) { | 978 if (rv == NGX_DECLINED) { |
959 p = r->header_name_start; | 979 p = r->header_name_start; |
960 | 980 |
981 r->lingering_close = 1; | |
982 | |
961 if (p == NULL) { | 983 if (p == NULL) { |
962 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 984 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
963 "client sent too large request"); | 985 "client sent too large request"); |
964 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); | 986 ngx_http_finalize_request(r, |
987 NGX_HTTP_REQUEST_HEADER_TOO_LARGE); | |
965 return; | 988 return; |
966 } | 989 } |
967 | 990 |
968 len = r->header_in->end - p; | 991 len = r->header_in->end - p; |
969 | 992 |
973 } | 996 } |
974 | 997 |
975 ngx_log_error(NGX_LOG_INFO, c->log, 0, | 998 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
976 "client sent too long header line: \"%*s\"", | 999 "client sent too long header line: \"%*s\"", |
977 len, r->header_name_start); | 1000 len, r->header_name_start); |
978 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); | 1001 |
1002 ngx_http_finalize_request(r, | |
1003 NGX_HTTP_REQUEST_HEADER_TOO_LARGE); | |
979 return; | 1004 return; |
980 } | 1005 } |
981 } | 1006 } |
982 | 1007 |
983 n = ngx_http_read_request_header(r); | 1008 n = ngx_http_read_request_header(r); |
2567 /* if ngx_http_request_t was freed then we need some other place */ | 2592 /* if ngx_http_request_t was freed then we need some other place */ |
2568 r->http_state = NGX_HTTP_KEEPALIVE_STATE; | 2593 r->http_state = NGX_HTTP_KEEPALIVE_STATE; |
2569 #endif | 2594 #endif |
2570 | 2595 |
2571 c->idle = 1; | 2596 c->idle = 1; |
2597 ngx_reusable_connection(c, 1); | |
2572 | 2598 |
2573 if (rev->ready) { | 2599 if (rev->ready) { |
2574 ngx_post_event(rev, &ngx_posted_events); | 2600 ngx_post_event(rev, &ngx_posted_events); |
2575 } | 2601 } |
2576 } | 2602 } |
2676 | 2702 |
2677 c->log->handler = ngx_http_log_error; | 2703 c->log->handler = ngx_http_log_error; |
2678 c->log->action = "reading client request line"; | 2704 c->log->action = "reading client request line"; |
2679 | 2705 |
2680 c->idle = 0; | 2706 c->idle = 0; |
2707 ngx_reusable_connection(c, 0); | |
2681 | 2708 |
2682 ngx_http_init_request(rev); | 2709 ngx_http_init_request(rev); |
2683 } | 2710 } |
2684 | 2711 |
2685 | 2712 |