comparison src/http/ngx_http_request.c @ 328:26ff8d6b618d NGINX_0_5_34

nginx 0.5.34 *) Change: now the full request line instead of URI only is written to error_log. *) Feature: Cygwin compatibility. Thanks to Vladimir Kutakov. *) Feature: the "merge_slashes" directive. *) Feature: the "gzip_vary" directive. *) Feature: the "server_tokens" directive. *) Feature: the "access_log" directive may be used inside the "limit_except" block. *) Bugfix: if the $server_protocol was used in FastCGI parameters and a request line length was near to the "client_header_buffer_size" directive value, then nginx issued an alert "fastcgi: the request record is too big". *) Bugfix: if a plain text HTTP/0.9 version request was made to HTTPS server, then nginx returned usual response. *) Bugfix: URL double escaping in a redirect of the "msie_refresh" directive; bug appeared in 0.5.28. *) Bugfix: a segmentation fault might occur in worker process if subrequests were used. *) Bugfix: the big responses may be transferred truncated if SSL and gzip were used. *) Bugfix: compatibility with mget. *) Bugfix: nginx did not unescape URI in the "include" SSI command. *) Bugfix: the segmentation fault was occurred on start or while reconfiguration if variable was used in the "charset" or "source_charset" directives. *) Bugfix: nginx returned the 400 response on requests like "GET http://www.domain.com HTTP/1.0". Thanks to James Oakley. *) Bugfix: a segmentation fault occurred in worker process if $date_local and $date_gmt were used outside the ngx_http_ssi_filter_module. *) Bugfix: a segmentation fault might occur in worker process if debug log was enabled. Thanks to Andrei Nigmatulin. *) Bugfix: ngx_http_memcached_module did not set $upstream_response_time. Thanks to Maxim Dounin. *) Bugfix: a worker process may got caught in an endless loop, if the memcached was used.
author Igor Sysoev <http://sysoev.ru>
date Thu, 13 Dec 2007 00:00:00 +0300
parents f70f2f565fe0
children c60beecc6ab5
comparison
equal deleted inserted replaced
327:cb962a94cd7b 328:26ff8d6b618d
601 601
602 602
603 static void 603 static void
604 ngx_http_process_request_line(ngx_event_t *rev) 604 ngx_http_process_request_line(ngx_event_t *rev)
605 { 605 {
606 ssize_t n; 606 ssize_t n;
607 ngx_int_t rc, rv; 607 ngx_int_t rc, rv;
608 ngx_connection_t *c; 608 ngx_connection_t *c;
609 ngx_http_request_t *r; 609 ngx_http_request_t *r;
610 ngx_http_core_srv_conf_t *cscf;
610 611
611 c = rev->data; 612 c = rev->data;
612 r = c->data; 613 r = c->data;
613 614
614 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, 615 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0,
656 if (r->uri.data == NULL) { 657 if (r->uri.data == NULL) {
657 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 658 ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
658 return; 659 return;
659 } 660 }
660 661
661 rc = ngx_http_parse_complex_uri(r); 662 cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
663
664 rc = ngx_http_parse_complex_uri(r, cscf->merge_slashes);
662 665
663 if (rc == NGX_HTTP_PARSE_INVALID_REQUEST) { 666 if (rc == NGX_HTTP_PARSE_INVALID_REQUEST) {
664 ngx_log_error(NGX_LOG_INFO, c->log, 0, 667 ngx_log_error(NGX_LOG_INFO, c->log, 0,
665 "client sent invalid request"); 668 "client sent invalid request");
666 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); 669 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
1146 1149
1147 if (r->args_start) { 1150 if (r->args_start) {
1148 r->args_start = new + (r->args_start - old); 1151 r->args_start = new + (r->args_start - old);
1149 } 1152 }
1150 1153
1154 if (r->http_protocol.data) {
1155 r->http_protocol.data = new + (r->http_protocol.data - old);
1156 }
1157
1151 } else { 1158 } else {
1152 r->header_name_start = new; 1159 r->header_name_start = new;
1153 r->header_name_end = new + (r->header_name_end - old); 1160 r->header_name_end = new + (r->header_name_end - old);
1154 r->header_start = new + (r->header_start - old); 1161 r->header_start = new + (r->header_start - old);
1155 r->header_end = new + (r->header_end - old); 1162 r->header_end = new + (r->header_end - old);
1327 "client sent \"Transfer-Encoding: chunked\" header"); 1334 "client sent \"Transfer-Encoding: chunked\" header");
1328 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED); 1335 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
1329 return NGX_ERROR; 1336 return NGX_ERROR;
1330 } 1337 }
1331 1338
1332 if (r->plain_http) {
1333 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1334 "client sent plain HTTP request to HTTPS port");
1335 ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
1336 return NGX_ERROR;
1337 }
1338
1339 if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) { 1339 if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) {
1340 if (r->headers_in.keep_alive) { 1340 if (r->headers_in.keep_alive) {
1341 r->headers_in.keep_alive_n = 1341 r->headers_in.keep_alive_n =
1342 ngx_atotm(r->headers_in.keep_alive->value.data, 1342 ngx_atotm(r->headers_in.keep_alive->value.data,
1343 r->headers_in.keep_alive->value.len); 1343 r->headers_in.keep_alive->value.len);
1400 long rc; 1400 long rc;
1401 ngx_http_ssl_srv_conf_t *sscf; 1401 ngx_http_ssl_srv_conf_t *sscf;
1402 #endif 1402 #endif
1403 1403
1404 c = r->connection; 1404 c = r->connection;
1405
1406 if (r->plain_http) {
1407 ngx_log_error(NGX_LOG_INFO, c->log, 0,
1408 "client sent plain HTTP request to HTTPS port");
1409 ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS);
1410 return;
1411 }
1405 1412
1406 #if (NGX_HTTP_SSL) 1413 #if (NGX_HTTP_SSL)
1407 1414
1408 if (c->ssl) { 1415 if (c->ssl) {
1409 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); 1416 sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module);
2594 p = ngx_snprintf(buf, len, ", server: %V", &r->server_name); 2601 p = ngx_snprintf(buf, len, ", server: %V", &r->server_name);
2595 len -= p - buf; 2602 len -= p - buf;
2596 buf = p; 2603 buf = p;
2597 } 2604 }
2598 2605
2599 if (r->unparsed_uri.data) { 2606 if (r->request_line.data == NULL && r->request_start) {
2600 p = ngx_snprintf(buf, len, ", URL: \"%V\"", &r->unparsed_uri); 2607 for (p = r->request_start; p < r->header_in->last; p++) {
2608 if (*p == CR || *p == LF) {
2609 break;
2610 }
2611 }
2612
2613 r->request_line.len = p - r->request_start;
2614 r->request_line.data = r->request_start;
2615 }
2616
2617 if (r->request_line.len) {
2618 p = ngx_snprintf(buf, len, ", request: \"%V\"", &r->request_line);
2601 len -= p - buf; 2619 len -= p - buf;
2602 buf = p; 2620 buf = p;
2603
2604 } else {
2605 if (r->request_line.data == NULL && r->request_start) {
2606 for (p = r->request_start; p < r->header_in->last; p++) {
2607 if (*p == CR || *p == LF) {
2608 break;
2609 }
2610 }
2611
2612 r->request_line.len = p - r->request_start;
2613 r->request_line.data = r->request_start;
2614 }
2615
2616 if (r->request_line.len) {
2617 p = ngx_snprintf(buf, len, ", request: \"%V\"", &r->request_line);
2618 len -= p - buf;
2619 buf = p;
2620 }
2621 } 2621 }
2622 2622
2623 if (r != sr) { 2623 if (r != sr) {
2624 p = ngx_snprintf(buf, len, ", subrequest: \"%V\"", &sr->uri); 2624 p = ngx_snprintf(buf, len, ", subrequest: \"%V\"", &sr->uri);
2625 len -= p - buf; 2625 len -= p - buf;