comparison src/http/ngx_http_request.c @ 52:0d75d65c642f NGINX_0_1_26

nginx 0.1.26 *) Change: the invalid client header lines are now ignored and logged at the info level. *) Change: the server name is also logged in error log. *) Feature: the ngx_http_auth_basic_module module and the auth_basic and auth_basic_user_file directives.
author Igor Sysoev <http://sysoev.ru>
date Tue, 22 Mar 2005 00:00:00 +0300
parents 72eb30262aac
children bcb5fce0b038
comparison
equal deleted inserted replaced
51:43f383e47efc 52:0d75d65c642f
720 static void 720 static void
721 ngx_http_process_request_headers(ngx_event_t *rev) 721 ngx_http_process_request_headers(ngx_event_t *rev)
722 { 722 {
723 ssize_t n; 723 ssize_t n;
724 ngx_int_t rc, rv, i; 724 ngx_int_t rc, rv, i;
725 ngx_str_t header;
725 ngx_table_elt_t *h, **cookie; 726 ngx_table_elt_t *h, **cookie;
726 ngx_connection_t *c; 727 ngx_connection_t *c;
727 ngx_http_request_t *r; 728 ngx_http_request_t *r;
728 729
729 c = rev->data; 730 c = rev->data;
768 } 769 }
769 770
770 rc = ngx_http_parse_header_line(r, r->header_in); 771 rc = ngx_http_parse_header_line(r, r->header_in);
771 772
772 if (rc == NGX_OK) { 773 if (rc == NGX_OK) {
774
775 if (r->invalid_header) {
776
777 /* there was error while a header line parsing */
778
779 header.len = r->header_end - r->header_name_start;
780 header.data = r->header_name_start;
781
782 ngx_log_error(NGX_LOG_INFO, rev->log, 0,
783 "client sent invalid header: \"%V\", ignored,",
784 &header);
785 continue;
786 }
773 787
774 /* a header line has been parsed successfully */ 788 /* a header line has been parsed successfully */
775 789
776 r->headers_n++; 790 r->headers_n++;
777 791
2369 return p; 2383 return p;
2370 } 2384 }
2371 2385
2372 len -= p - buf; 2386 len -= p - buf;
2373 2387
2388 if (ctx->request->server_name.data) {
2389 p = ngx_snprintf(p, len, ", host: %V", &ctx->request->server_name);
2390 len -= p - buf;
2391 }
2392
2374 p = ngx_snprintf(p, len, ", URL: \"%V\"", &ctx->request->unparsed_uri); 2393 p = ngx_snprintf(p, len, ", URL: \"%V\"", &ctx->request->unparsed_uri);
2375 2394
2376 if (ctx->request->headers_in.referer == NULL) { 2395 if (ctx->request->headers_in.referer == NULL) {
2377 return p; 2396 return p;
2378 } 2397 }