comparison src/http/ngx_http_request.c @ 535:80f7156c2965 NGINX_0_8_14

nginx 0.8.14 *) 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 embedded perl module; the bug had appeared in 0.8.11. *) Bugfix: an "error_page" directive did not redirect a 413 error; the bug had appeared in 0.6.10.
author Igor Sysoev <http://sysoev.ru>
date Mon, 07 Sep 2009 00:00:00 +0400
parents d41628eb4d0a
children 005a70f9573b
comparison
equal deleted inserted replaced
534:441fbf722b8c 535:80f7156c2965
891 891
892 892
893 static void 893 static void
894 ngx_http_process_request_headers(ngx_event_t *rev) 894 ngx_http_process_request_headers(ngx_event_t *rev)
895 { 895 {
896 u_char *p;
897 size_t len;
896 ssize_t n; 898 ssize_t n;
897 ngx_int_t rc, rv; 899 ngx_int_t rc, rv;
898 ngx_str_t header;
899 ngx_table_elt_t *h; 900 ngx_table_elt_t *h;
900 ngx_connection_t *c; 901 ngx_connection_t *c;
901 ngx_http_header_t *hh; 902 ngx_http_header_t *hh;
902 ngx_http_request_t *r; 903 ngx_http_request_t *r;
903 ngx_http_core_srv_conf_t *cscf; 904 ngx_http_core_srv_conf_t *cscf;
933 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 934 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
934 return; 935 return;
935 } 936 }
936 937
937 if (rv == NGX_DECLINED) { 938 if (rv == NGX_DECLINED) {
938 header.len = r->header_in->end - r->header_name_start; 939 len = r->header_in->end - r->header_name_start;
939 header.data = r->header_name_start; 940 p = r->header_name_start;
940 941
941 if (header.len > NGX_MAX_ERROR_STR - 300) { 942 if (len > NGX_MAX_ERROR_STR - 300) {
942 header.len = NGX_MAX_ERROR_STR - 300; 943 len = NGX_MAX_ERROR_STR - 300;
943 header.data[header.len++] = '.'; 944 p[len++] = '.'; p[len++] = '.'; p[len++] = '.';
944 header.data[header.len++] = '.';
945 header.data[header.len++] = '.';
946 } 945 }
947 946
948 ngx_log_error(NGX_LOG_INFO, c->log, 0, 947 ngx_log_error(NGX_LOG_INFO, c->log, 0,
949 "client sent too long header line: \"%V\"", 948 "client sent too long header line: \"%*s\"",
950 &header); 949 len, r->header_name_start);
951 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); 950 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
952 return; 951 return;
953 } 952 }
954 } 953 }
955 954
967 966
968 if (r->invalid_header && cscf->ignore_invalid_headers) { 967 if (r->invalid_header && cscf->ignore_invalid_headers) {
969 968
970 /* there was error while a header line parsing */ 969 /* there was error while a header line parsing */
971 970
972 header.len = r->header_end - r->header_name_start;
973 header.data = r->header_name_start;
974
975 ngx_log_error(NGX_LOG_INFO, c->log, 0, 971 ngx_log_error(NGX_LOG_INFO, c->log, 0,
976 "client sent invalid header line: \"%V\"", 972 "client sent invalid header line: \"%*s\"",
977 &header); 973 r->header_end - r->header_name_start,
974 r->header_name_start);
978 continue; 975 continue;
979 } 976 }
980 977
981 /* a header line has been parsed successfully */ 978 /* a header line has been parsed successfully */
982 979
1052 continue; 1049 continue;
1053 } 1050 }
1054 1051
1055 /* rc == NGX_HTTP_PARSE_INVALID_HEADER: "\r" is not followed by "\n" */ 1052 /* rc == NGX_HTTP_PARSE_INVALID_HEADER: "\r" is not followed by "\n" */
1056 1053
1057 header.len = r->header_end - r->header_name_start;
1058 header.data = r->header_name_start;
1059 ngx_log_error(NGX_LOG_INFO, c->log, 0, 1054 ngx_log_error(NGX_LOG_INFO, c->log, 0,
1060 "client sent invalid header line: \"%V\\r...\"", 1055 "client sent invalid header line: \"%*s\\r...\"",
1061 &header); 1056 r->header_end - r->header_name_start,
1057 r->header_name_start);
1062 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); 1058 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
1063 return; 1059 return;
1064 } 1060 }
1065 } 1061 }
1066 1062