Mercurial > hg > nginx
comparison src/http/ngx_http_request.c @ 4930:6f085bfcdb4d
Request body: chunked transfer encoding support.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 21 Nov 2012 01:08:11 +0000 |
parents | 1e666c78a42c |
children | 7fa7e60a7f66 |
comparison
equal
deleted
inserted
replaced
4929:5a44d638cd27 | 4930:6f085bfcdb4d |
---|---|
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 = |