mirror of
https://github.com/nginx/nginx.git
synced 2025-07-24 14:16:20 +08:00
HTTP: Remove redundant state from chunk parsing
The state machine never returns with state = sw_chunk_data and a size of zero, nor did it return with state = sw_after_data.
This commit is contained in:
parent
626b1d9bba
commit
436282ff74
@ -2292,7 +2292,6 @@ ngx_http_parse_chunked(ngx_http_request_t *r, ngx_buf_t *b,
|
||||
sw_chunk_extension_unquoted_value,
|
||||
sw_chunk_extension_almost_done,
|
||||
sw_chunk_data,
|
||||
sw_after_data,
|
||||
sw_after_data_almost_done,
|
||||
sw_trailer,
|
||||
sw_trailer_almost_done,
|
||||
@ -2303,10 +2302,6 @@ ngx_http_parse_chunked(ngx_http_request_t *r, ngx_buf_t *b,
|
||||
|
||||
state = ctx->state;
|
||||
|
||||
if (state == sw_chunk_data && ctx->size == 0) {
|
||||
state = sw_after_data;
|
||||
}
|
||||
|
||||
rc = NGX_AGAIN;
|
||||
|
||||
for (pos = b->pos; pos < b->last; pos++) {
|
||||
@ -2470,10 +2465,10 @@ before_semi:
|
||||
goto invalid;
|
||||
|
||||
case sw_chunk_data:
|
||||
rc = NGX_OK;
|
||||
goto data;
|
||||
|
||||
case sw_after_data:
|
||||
if (ctx->size != 0) {
|
||||
rc = NGX_OK;
|
||||
goto data;
|
||||
}
|
||||
if (ch == CR) {
|
||||
state = sw_after_data_almost_done;
|
||||
break;
|
||||
@ -2608,9 +2603,6 @@ data:
|
||||
case sw_chunk_data:
|
||||
ctx->length = min_length;
|
||||
break;
|
||||
case sw_after_data:
|
||||
ctx->length = 6 /* CR LF "0" CR LF LF */;
|
||||
break;
|
||||
case sw_after_data_almost_done:
|
||||
ctx->length = 5 /* LF "0" CR LF LF */;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user