comparison src/http/ngx_http_request.c @ 500:ed3d382670c7 NGINX_0_7_62

nginx 0.7.62 *) Security: a segmentation fault might occur in worker process while specially crafted request handling. Thanks to Chris Ries. *) Feature: the $upstream_cache_status variable. *) Bugfix: an expired cached response might stick in the "UPDATING" state. *) Bugfix: a segmentation fault might occur in worker process, if error_log was set to info or debug level. Thanks to Sergey Bochenkov. *) Bugfix: in handling FastCGI headers split in records. *) Bugfix: XSLT filter may fail with message "not well formed XML document" for valid XML document. Thanks to Kuramoto Eiji. *) Bugfix: now in MacOSX, Cygwin, and nginx/Windows locations given by a regular expression are always tested in case insensitive mode. *) Bugfix: now nginx/Windows ignores trailing dots in URI. Thanks to Hugo Leisink. *) Bugfix: name of file specified in --conf-path was not honored during installation; the bug had appeared in 0.6.6. Thanks to Maxim Dounin. *) Bugfix: a 500 error code was returned for invalid login/password while HTTP Basic authentication on Windows.
author Igor Sysoev <http://sysoev.ru>
date Mon, 14 Sep 2009 00:00:00 +0400
parents ef5c97e49c35
children 89dc5654117c
comparison
equal deleted inserted replaced
499:f2c782e5161f 500:ed3d382670c7
761 if (r->args_start && r->uri_end > r->args_start) { 761 if (r->args_start && r->uri_end > r->args_start) {
762 r->args.len = r->uri_end - r->args_start; 762 r->args.len = r->uri_end - r->args_start;
763 r->args.data = r->args_start; 763 r->args.data = r->args_start;
764 } 764 }
765 765
766 #if (NGX_WIN32)
767 {
768 u_char *p;
769
770 p = r->uri.data + r->uri.len - 1;
771
772 if (*p == '.') {
773
774 while (--p > r->uri.data && *p == '.') { /* void */ }
775
776 r->uri.len = p + 1 - r->uri.data;
777
778 ngx_http_set_exten(r);
779 }
780 }
781 #endif
766 782
767 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 783 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
768 "http request line: \"%V\"", &r->request_line); 784 "http request line: \"%V\"", &r->request_line);
769 785
770 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, 786 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
867 883
868 884
869 static void 885 static void
870 ngx_http_process_request_headers(ngx_event_t *rev) 886 ngx_http_process_request_headers(ngx_event_t *rev)
871 { 887 {
888 u_char *p;
889 size_t len;
872 ssize_t n; 890 ssize_t n;
873 ngx_int_t rc, rv; 891 ngx_int_t rc, rv;
874 ngx_str_t header;
875 ngx_table_elt_t *h; 892 ngx_table_elt_t *h;
876 ngx_connection_t *c; 893 ngx_connection_t *c;
877 ngx_http_header_t *hh; 894 ngx_http_header_t *hh;
878 ngx_http_request_t *r; 895 ngx_http_request_t *r;
879 ngx_http_core_srv_conf_t *cscf; 896 ngx_http_core_srv_conf_t *cscf;
909 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 926 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
910 return; 927 return;
911 } 928 }
912 929
913 if (rv == NGX_DECLINED) { 930 if (rv == NGX_DECLINED) {
914 header.len = r->header_in->end - r->header_name_start; 931 len = r->header_in->end - r->header_name_start;
915 header.data = r->header_name_start; 932 p = r->header_name_start;
916 933
917 if (header.len > NGX_MAX_ERROR_STR - 300) { 934 if (len > NGX_MAX_ERROR_STR - 300) {
918 header.len = NGX_MAX_ERROR_STR - 300; 935 len = NGX_MAX_ERROR_STR - 300;
919 header.data[header.len++] = '.'; 936 p[len++] = '.'; p[len++] = '.'; p[len++] = '.';
920 header.data[header.len++] = '.';
921 header.data[header.len++] = '.';
922 } 937 }
923 938
924 ngx_log_error(NGX_LOG_INFO, c->log, 0, 939 ngx_log_error(NGX_LOG_INFO, c->log, 0,
925 "client sent too long header line: \"%V\"", 940 "client sent too long header line: \"%*s\"",
926 &header); 941 len, r->header_name_start);
927 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); 942 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
928 return; 943 return;
929 } 944 }
930 } 945 }
931 946
943 958
944 if (r->invalid_header && cscf->ignore_invalid_headers) { 959 if (r->invalid_header && cscf->ignore_invalid_headers) {
945 960
946 /* there was error while a header line parsing */ 961 /* there was error while a header line parsing */
947 962
948 header.len = r->header_end - r->header_name_start;
949 header.data = r->header_name_start;
950
951 ngx_log_error(NGX_LOG_INFO, c->log, 0, 963 ngx_log_error(NGX_LOG_INFO, c->log, 0,
952 "client sent invalid header line: \"%V\"", 964 "client sent invalid header line: \"%*s\"",
953 &header); 965 r->header_end - r->header_name_start,
966 r->header_name_start);
954 continue; 967 continue;
955 } 968 }
956 969
957 /* a header line has been parsed successfully */ 970 /* a header line has been parsed successfully */
958 971
1028 continue; 1041 continue;
1029 } 1042 }
1030 1043
1031 /* rc == NGX_HTTP_PARSE_INVALID_HEADER: "\r" is not followed by "\n" */ 1044 /* rc == NGX_HTTP_PARSE_INVALID_HEADER: "\r" is not followed by "\n" */
1032 1045
1033 header.len = r->header_end - r->header_name_start;
1034 header.data = r->header_name_start;
1035 ngx_log_error(NGX_LOG_INFO, c->log, 0, 1046 ngx_log_error(NGX_LOG_INFO, c->log, 0,
1036 "client sent invalid header line: \"%V\\r...\"", 1047 "client sent invalid header line: \"%*s\\r...\"",
1037 &header); 1048 r->header_end - r->header_name_start,
1049 r->header_name_start);
1038 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); 1050 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
1039 return; 1051 return;
1040 } 1052 }
1041 } 1053 }
1042 1054