comparison src/http/ngx_http_request.c @ 692:6db6e93f55ee NGINX_1_3_9

nginx 1.3.9 *) Feature: support for chunked transfer encoding while reading client request body. *) Feature: the $request_time and $msec variables can now be used not only in the "log_format" directive. *) Bugfix: cache manager and cache loader processes might not be able to start if more than 512 listen sockets were used. *) Bugfix: in the ngx_http_dav_module.
author Igor Sysoev <http://sysoev.ru>
date Tue, 27 Nov 2012 00:00:00 +0400
parents b5b7eea22fda
children
comparison
equal deleted inserted replaced
691:acfd484db0ca 692:6db6e93f55ee
1572 r->headers_in.content_length->value.len); 1572 r->headers_in.content_length->value.len);
1573 1573
1574 if (r->headers_in.content_length_n == NGX_ERROR) { 1574 if (r->headers_in.content_length_n == NGX_ERROR) {
1575 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 1575 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1576 "client sent invalid \"Content-Length\" header"); 1576 "client sent invalid \"Content-Length\" header");
1577 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED); 1577 ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
1578 return NGX_ERROR; 1578 return NGX_ERROR;
1579 } 1579 }
1580 }
1581
1582 if (r->method & NGX_HTTP_PUT && r->headers_in.content_length_n == -1) {
1583 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1584 "client sent %V method without \"Content-Length\" header",
1585 &r->method_name);
1586 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
1587 return NGX_ERROR;
1588 } 1580 }
1589 1581
1590 if (r->method & NGX_HTTP_TRACE) { 1582 if (r->method & NGX_HTTP_TRACE) {
1591 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 1583 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1592 "client sent TRACE method"); 1584 "client sent TRACE method");
1593 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED); 1585 ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
1594 return NGX_ERROR; 1586 return NGX_ERROR;
1595 } 1587 }
1596 1588
1597 if (r->headers_in.transfer_encoding 1589 if (r->headers_in.transfer_encoding) {
1598 && ngx_strcasestrn(r->headers_in.transfer_encoding->value.data, 1590 if (r->headers_in.transfer_encoding->value.len == 7
1599 "chunked", 7 - 1)) 1591 && ngx_strncasecmp(r->headers_in.transfer_encoding->value.data,
1600 { 1592 (u_char *) "chunked", 7) == 0)
1601 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 1593 {
1602 "client sent \"Transfer-Encoding: chunked\" header"); 1594 r->headers_in.content_length = NULL;
1603 ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED); 1595 r->headers_in.content_length_n = -1;
1604 return NGX_ERROR; 1596 r->headers_in.chunked = 1;
1597
1598 } else if (r->headers_in.transfer_encoding->value.len != 8
1599 || ngx_strncasecmp(r->headers_in.transfer_encoding->value.data,
1600 (u_char *) "identity", 8) != 0)
1601 {
1602 ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
1603 "client sent unknown \"Transfer-Encoding\": \"%V\"",
1604 &r->headers_in.transfer_encoding->value);
1605 ngx_http_finalize_request(r, NGX_HTTP_NOT_IMPLEMENTED);
1606 return NGX_ERROR;
1607 }
1605 } 1608 }
1606 1609
1607 if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) { 1610 if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) {
1608 if (r->headers_in.keep_alive) { 1611 if (r->headers_in.keep_alive) {
1609 r->headers_in.keep_alive_n = 1612 r->headers_in.keep_alive_n =