Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 3076:44ac242eb6ac
use %*s instead of %V
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 01 Sep 2009 12:35:52 +0000 |
parents | 23e6f26fb4bd |
children | 9160a117a46a |
comparison
equal
deleted
inserted
replaced
3075:dcf50b4c7ec6 | 3076:44ac242eb6ac |
---|---|
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 |